(Answer) (Category) FAQ-O-Matic : (Category) JBuilder 6 Known Bugs :
Compiling code containing JDK 1.4's new "assert" keyword while an earlier JDK (1.3.1 or earlier) is selected causes an Error #: 2301: internal compiler error: java.lang.NullPointerException.
If you enable asserts, the compiler should create a class with the 'version 48' thing, which will require a 1.4 JDK to load and run. Trying to compile code containing the 'assert' keyword with a pre-1.4 compiler is not going to work. JBuilder should detect this situation and give a better error message, for sure.

I don't have a 1.4 beta on my home machine to test this with fully, but I can still reproduce the NPE:

Create a one-class project and assign it a 1.3.1 JDK.

Selecting different target JDKs (IE 'all', 'JDK 1.2', 'JDK 1.3', or 'JDK 1.4') doesn't matter, the error still appears.

Leave asserts disabled (Project Properties | General), project compiles but you get a 'no such method' error on the assert line.

Enable asserts. Now you get a 2301 error and the following appears in the -verbose output:

  java.lang.NullPointerException
        at com.borland.compiler.frontend.Unop.b(Unknown Source)
        at com.borland.compiler.frontend.Assignop.b(Unknown Source)
        at com.borland.compiler.frontend.AST.c(Unknown Source)
        at com.borland.compiler.frontend.Exec.b(Unknown Source)
        at com.borland.compiler.frontend.AST.c(Unknown Source)
        at com.borland.compiler.frontend.FunDef.a(Unknown Source)
        at com.borland.compiler.frontend.FunDef.b(Unknown Source)
        at com.borland.compiler.frontend.AST.c(Unknown Source)
        at com.borland.compiler.frontend.ClassDef.a(Unknown Source)
        at com.borland.compiler.frontend.TopLevel.a(Unknown Source)
        at com.borland.compiler.frontend.JavaCompiler.a(Unknown Source)
        at com.borland.compiler.frontend.JavaCompiler.compile(Unknown Source)
        at com.borland.compiler.frontend.JavaCompiler.compile(Unknown Source)
        at com.borland.javamaker.ProjectEntry.a(Unknown Source)
        at com.borland.javamaker.a.compile(Unknown Source)
        at com.borland.javamaker.x.make(Unknown Source)
        at com.borland.javamaker.x.a(Unknown Source)
        at com.borland.javamaker.ProjectEntry.compile(Unknown Source)
        at com.borland.javamaker.ProjectEntry.make(Unknown Source)
        at com.borland.javamaker.NewJavaMaker.makeThem(Unknown Source)
        at com.borland.jbuilder.build.JavaBuildTask.build(Unknown Source)
        at com.borland.primetime.build.BuildProcess.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:484)

Workarounds:
If you must compile with a 1.3.1 or earlier JDK, you should disable the assert keyword (Project Properties | General) and then:

  1) comment out or delete all asserts already in the code;
  2) provide an assert method somewhere where each class can find it:
 
public void assert( boolean exp ) {}

This will allow the project to compile and run until you have a 1.4-compatible JDK available.

2002-Jan-05 8:37am gyles19@visi.com

Another gotcha: If you attempt to use the Designer on a class which contains a fake assert() method shown above, the designer will kack. So, the fake-assert workaround won't be useful for visual components you wish to manipulate with the Designer.

   java.lang.NullPointerException
        at com.borland.jbuilder.jot.src.eb.c(Unknown Source)
        at com.borland.jbuilder.jot.src.cc.h(Unknown Source)
        at com.borland.jbuilder.jot.src.eb.getDeclaredName(Unknown Source)
        at com.borland.jbuilder.jot.src.eb.getName(Unknown Source)
        at com.borland.jbuilder.jot.src.cd.execute(Unknown Source)
        at com.borland.jbuilder.jot.src.jd.seek(Unknown Source)
        at com.borland.jbuilder.jot.src.jd.hasNext(Unknown Source)
        at com.borland.jbuilder.jot.src.qc.a(Unknown Source)
        at com.borland.jbuilder.jot.src.nc.getDeclaredMethod(Unknown Source)
        at com.borland.jbuilder.jot.src.nc.getMethod(Unknown Source)
        at com.borland.jbuilder.cmt.jb.JbComponent.getMethod(Unknown Source)
        at com.borland.jbuilder.cmt.jb.JbComponent.h(Unknown Source)
        at com.borland.jbuilder.cmt.jb.JbComponent.q(Unknown Source)
        at com.borland.jbuilder.cmt.jb.JbComponent.init(Unknown Source)
        at com.borland.jbuilder.cmt.CmtComponentManager.getComponent(Unknown Source)
        at com.borland.jbuilder.cmt.CmtComponentManager.getComponent(Unknown Source)
        at com.borland.jbuilder.cmt.CmtComponentManager.getComponent(Unknown Source)
        at com.borland.jbuilder.designer.DesignerViewer.getComponentSource(Unknown Source)
        at com.borland.jbuilder.designer.inspector.InspectorView.a(Unknown Source)
        at com.borland.jbuilder.designer.inspector.InspectorView.setTarget(Unknown Source)
        at com.borland.jbuilder.designer.inspector.InspectorView.init(Unknown Source)
        at com.borland.jbuilder.designer.inspector.Inspector.a(Unknown Source)
        at com.borland.jbuilder.designer.inspector.Inspector.init(Unknown Source)
        at com.borland.jbuilder.designer.i.run(Unknown Source)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:154)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:337)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)                                   

2002-Jan-05 8:53am gyles19@visi.com
[Append to This Answer]
2002-Jan-05 8:53am
Previous: (Answer) Code Insight doesn't work inside JSP files.
Next: (Answer) In Project Properties | Run | Test tab, only two JUnit Test Runners are available, the JUnit Text UI, and the JUnit Swing UI. The JBTestRunner selection is not present. Sometimes, though, it appears, but often it doesn't.
This document is: http://www.visi.com/~gyles19/cgi-bin/fom.cgi?file=317
[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 ]