Bug 8530 - Internal error using assertions (1.4 feature)
Summary: Internal error using assertions (1.4 feature)
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P1 normal (vote)
Target Milestone: 2.0 M3   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-26 07:39 EST by Philipe Mulet CLA
Modified: 2002-01-26 07:40 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2002-01-26 07:39:53 EST
Build 20020124

When compiling the following code, an internal error occurs.

package p1;

public class X {
	public static void main(String[] arguments) {
		try {
		        long l = 2L;
			assert false : i;
		} catch (AssertionError e) {
			System.out.println(e.getMessage());
		}
	}
}

java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.ast.AssertStatement.resolve
(AssertStatement.java:113)
	at org.eclipse.jdt.internal.compiler.ast.Block.resolveUsing
(Block.java:91)
	at org.eclipse.jdt.internal.compiler.ast.TryStatement.resolve
(TryStatement.java:358)
	at 
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve
(AbstractMethodDeclaration.java:269)
	at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolve
(MethodDeclaration.java:66)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(TypeDeclaration.java:726)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(TypeDeclaration.java:754)
	at 
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve
(CompilationUnitDeclaration.java:188)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:453)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:261)
	at 
org.eclipse.jdt.tests.compiler.regression.AbstractRegressionTest.runConformTest
(AbstractRegressionTest.java:151)
	at 
org.eclipse.jdt.tests.compiler.regression.AssertionTest.testAssertionWithLongArg
uments(AssertionTest.java:125)
	at java.lang.reflect.Method.invoke(Native Method)
	at junit.framework.TestCase.runTest(TestCase.java:166)
	at junit.framework.TestCase.runBare(TestCase.java:140)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:131)
	at junit.framework.TestSuite.runTest(TestSuite.java:173)
	at junit.framework.TestSuite.run(TestSuite.java:168)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
	at junit.extensions.TestDecorator.run(TestDecorator.java:28)
	at org.eclipse.jdt.tests.compiler.regression.RegressionTestSetup.run
(RegressionTestSetup.java:38)
	at junit.swtgui.TestRunner$17.run(TestRunner.java:732)
Comment 1 Philipe Mulet CLA 2002-01-26 07:40:39 EST
Compiler is missing protection when reporting errors inside assertion argument 
expressions (variable 'i' is not defined).