(Answer) (Category) FAQ-O-Matic : (Category) General : (Category) Compiler :
Error#2301:Internal compiler error: com.borland.compiler.symtab.CompilerError: unexpected type: null
Matthew Mower writes:

I've already resolved the problem, but thought I would document it since (a) someone else might come across it and (b) I don't think the error message was very helpful in determining the cause of the problem - even though it was accurate.

I received the error while trying to recompile a JUnit test suite which uses a number of inner class implemenations of other classes in our framework.

The error was because I had recently removed a parameter from the constructor of the class that was being created as an inner class. I had removed this parameter from constructors all over our code, but had forgotten that these inner classes extended the modified class and so was still passing a null for the parameter - hence the error is accurate.

However:

-JBuilders "internal compiler error" foxed me into thinking I had broken the compiler, and lead me away from thinking it was a simple problem with my own code.

-JBuilder could have highlighted the point where the unexpected type was occuring and lead me to realize what I had done much sooner. I'm not sure i'd have solved it yet if another poster in this group hadn't mentioned internal compiler issues with inner classes.

I think JBuilder should handle this case better.

2001-May-14 1:23pm gyles19@visi.com

An example that triggers this confusing error message is the line below:

  BrowserAction foo = new BrowserAction( "menuitem", 'm', "tooltip") {
    ...
  }

The compiler is expecting a character value for the second parameter. If you replace the 'm' with the null keyword, the compiler produces the unexpected type message. Unfortuately, it fails to provide a line number reference so you probably have no idea what caused it.
2001-Jul-15 3:37pm gyles19@visi.com

Matthew Mower writes:

Here is the simple test case:

  public class Untitled1 {
        public Untitled1() {
        }
  }
public class Untitled2 { public Untitled2() { Untitled1 _u = new Untitled1( null ) { }; } }

I think the compiler should be able to generate a "constructor not found" error in this case, and not go bust.

2001-Sep-08 2:23pm gyles19@visi.com

[Append to This Answer]
2001-Sep-08 2:23pm
Previous: (Answer) I'm trying to compile a project and I'm getting something about "Error 900: out of memory". This project doesn't seem to be that big.
Next: (Answer) I am not receiving the deprecation warnings I expected. The "show deprecation warnings" setting is enabled.
This document is: http://www.visi.com/~gyles19/cgi-bin/fom.cgi?file=165
[Search] [Appearance]
This is a Faq-O-Matic 2.709.
This FAQ administered by gyles19@visi.com.

Other JBuilder Links

Java Community
Java Tools
Code Central
JB OpenTools
Community
Recent
Threads
Borland Chat
Chat FAQ
Feature Matrices
3.0 |  3.5 |  4.0
5.0 |  6.0 |  7.0
Shop for
JBuilder
JBuilder
Downloads
and reg keys
Report Piracy
Online Manuals
4.0 |  5.0 |  6.0
7.0
Borland
DevSupport's
Bug/RFE Form

Quality Central Client
JB Patches &
Updates
JBuilder FAQs TIs
JBuilder
Newsgroups
Tamaracka's
News Archive
Mr. Haki's
JBuilder Machine
JGuru's
JBuilder FAQ
Sun's Bug
Parade
Netring Home - About - Privacy
The
JBuilder Netring Logo
The Borland JBuilder Netring by JBuilder FAQ-O-Matic
[ Join Now | List Sites | Random | << Prev | Next >> ]
[ Previous 5 Sites | Skip Previous | Skip Next | Next 5 Sites ]