Exceptions when attempting JUnit launch (2 cases)
I am seeing two related but distinct exceptions/failures when attempting to launch ScalaTest test suites from the IDE. (The same tests launched OK some weeks ago on the 2.8.0 IDE - dont know why they've regressed.)
This one occurs when the Run > context menu is activated for the Source file node in Package Explorer, and stops it from ever showing options like "As JUnit / Scala Application etc":
java.lang.ArrayIndexOutOfBoundsException: 0
at org.eclipse.jdt.core.dom.ASTConverter.isPrimitiveType(ASTConverter.java:3555)
at org.eclipse.jdt.core.dom.ASTConverter.convertType(ASTConverter.java:3132)
at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2678)
at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1266)
at scala.tools.eclipse.contribution.weaving.jdt.core.DOMAspect.ajc$around$scala_tools_eclipse_contribution_weaving_jdt_core_DOMAspect$1$3b9eae81(DOMAspect.aj:139)
at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1042)
at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:789)
at org.eclipse.jdt.internal.junit.launcher.JUnit4TestFinder.internalIsTest(JUnit4TestFinder.java:229)
at org.eclipse.jdt.internal.junit.launcher.JUnit4TestFinder.isTest(JUnit4TestFinder.java:197)
at org.eclipse.jdt.internal.junit.util.CoreTestSearchEngine.isTestOrTestSuite(CoreTestSearchEngine.java:54)
at org.eclipse.jdt.internal.junit.JUnitPropertyTester.isJUnitTest(JUnitPropertyTester.java:113)
at org.eclipse.jdt.internal.junit.JUnitPropertyTester.canLaunchAsJUnitTest(JUnitPropertyTester.java:88)
at org.eclipse.jdt.internal.junit.JUnitPropertyTester.test(JUnitPropertyTester.java:71)
at org.eclipse.core.internal.expressions.Property.test(Property.java:58)
at org.eclipse.core.internal.expressions.TestExpression.evaluate(TestExpression.java:99)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
at org.eclipse.core.internal.expressions.AdaptExpression.evaluate(AdaptExpression.java:91)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
at org.eclipse.core.internal.expressions.IterateExpression.evaluate(IterateExpression.java:150)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
at org.eclipse.core.internal.expressions.WithExpression.evaluate(WithExpression.java:72)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
at org.eclipse.core.internal.expressions.EnablementExpression.evaluate(EnablementExpression.java:53)
at org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension.evalEnablementExpression(LaunchShortcutExtension.java:287)
...
While this one happened when I tried to launched all tests in a package.. intermittently. Other times, I get a message "No Junit Tests found" although there are many.
java.lang.NullPointerException
at org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.resolveStatements(ConstructorDeclaration.java:471)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:410)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1147)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1235)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:540)
at org.eclipse.jdt.internal.core.hierarchy.HierarchyResolver.resolve(HierarchyResolver.java:793)
at org.eclipse.jdt.internal.core.hierarchy.RegionBasedHierarchyBuilder.createTypeHierarchyBasedOnRegion(RegionBasedHierarchyBuilder.java:90)
at org.eclipse.jdt.internal.core.hierarchy.RegionBasedHierarchyBuilder.build(RegionBasedHierarchyBuilder.java:59)
at org.eclipse.jdt.internal.core.hierarchy.RegionBasedTypeHierarchy.compute(RegionBasedTypeHierarchy.java:97)
at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.refresh(TypeHierarchy.java:1263)
at org.eclipse.jdt.internal.core.CreateTypeHierarchyOperation.executeOperation(CreateTypeHierarchyOperation.java:90)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:788)
at org.eclipse.jdt.core.JavaCore.newTypeHierarchy(JavaCore.java:3944)
at org.eclipse.jdt.internal.junit.launcher.JUnit4TestFinder.findTestsInContainer(JUnit4TestFinder.java:128)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.evaluateTests(JUnitLaunchConfigurationDelegate.java:260)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launch(JUnitLaunchConfigurationDelegate.java:125)
I tried creating a small project to isolate & replicate the failing code, but in the isolated project the JUnit launcher works correctly with ScalaTest .
This one occurs when the Run > context menu is activated for the Source file node in Package Explorer, and stops it from ever showing options like "As JUnit / Scala Application etc":
java.lang.ArrayIndexOutOfBoundsException: 0
at org.eclipse.jdt.core.dom.ASTConverter.isPrimitiveType(ASTConverter.java:3555)
at org.eclipse.jdt.core.dom.ASTConverter.convertType(ASTConverter.java:3132)
at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2678)
at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1266)
at scala.tools.eclipse.contribution.weaving.jdt.core.DOMAspect.ajc$around$scala_tools_eclipse_contribution_weaving_jdt_core_DOMAspect$1$3b9eae81(DOMAspect.aj:139)
at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1042)
at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:789)
at org.eclipse.jdt.internal.junit.launcher.JUnit4TestFinder.internalIsTest(JUnit4TestFinder.java:229)
at org.eclipse.jdt.internal.junit.launcher.JUnit4TestFinder.isTest(JUnit4TestFinder.java:197)
at org.eclipse.jdt.internal.junit.util.CoreTestSearchEngine.isTestOrTestSuite(CoreTestSearchEngine.java:54)
at org.eclipse.jdt.internal.junit.JUnitPropertyTester.isJUnitTest(JUnitPropertyTester.java:113)
at org.eclipse.jdt.internal.junit.JUnitPropertyTester.canLaunchAsJUnitTest(JUnitPropertyTester.java:88)
at org.eclipse.jdt.internal.junit.JUnitPropertyTester.test(JUnitPropertyTester.java:71)
at org.eclipse.core.internal.expressions.Property.test(Property.java:58)
at org.eclipse.core.internal.expressions.TestExpression.evaluate(TestExpression.java:99)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
at org.eclipse.core.internal.expressions.AdaptExpression.evaluate(AdaptExpression.java:91)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
at org.eclipse.core.internal.expressions.IterateExpression.evaluate(IterateExpression.java:150)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
at org.eclipse.core.internal.expressions.WithExpression.evaluate(WithExpression.java:72)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
at org.eclipse.core.internal.expressions.EnablementExpression.evaluate(EnablementExpression.java:53)
at org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension.evalEnablementExpression(LaunchShortcutExtension.java:287)
...
While this one happened when I tried to launched all tests in a package.. intermittently. Other times, I get a message "No Junit Tests found" although there are many.
java.lang.NullPointerException
at org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.resolveStatements(ConstructorDeclaration.java:471)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:410)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1147)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1235)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:540)
at org.eclipse.jdt.internal.core.hierarchy.HierarchyResolver.resolve(HierarchyResolver.java:793)
at org.eclipse.jdt.internal.core.hierarchy.RegionBasedHierarchyBuilder.createTypeHierarchyBasedOnRegion(RegionBasedHierarchyBuilder.java:90)
at org.eclipse.jdt.internal.core.hierarchy.RegionBasedHierarchyBuilder.build(RegionBasedHierarchyBuilder.java:59)
at org.eclipse.jdt.internal.core.hierarchy.RegionBasedTypeHierarchy.compute(RegionBasedTypeHierarchy.java:97)
at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.refresh(TypeHierarchy.java:1263)
at org.eclipse.jdt.internal.core.CreateTypeHierarchyOperation.executeOperation(CreateTypeHierarchyOperation.java:90)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:788)
at org.eclipse.jdt.core.JavaCore.newTypeHierarchy(JavaCore.java:3944)
at org.eclipse.jdt.internal.junit.launcher.JUnit4TestFinder.findTestsInContainer(JUnit4TestFinder.java:128)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.evaluateTests(JUnitLaunchConfigurationDelegate.java:260)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launch(JUnitLaunchConfigurationDelegate.java:125)
I tried creating a small project to isolate & replicate the failing code, but in the isolated project the JUnit launcher works correctly with ScalaTest .
Leave a comment
on 2010-11-02 21:11 *
By Matthew Farwell
on 2010-11-07 22:37 *
By Matthew Farwell
Partially fixed by fix for #2785 (ArrayIndexOutOfBoundsException).
We are seeing the exact same problem and consistently get a NullPointerException when trying to run JUnit Plug-in Tests. Luckily, we have been able to create a very simple reproduction scenario:
We use Eclipse Helios (3.6) SR1 and have created a single bundle project with only one Scala source file:
The project has this manifest:
We use a custom target platform with a number of folders (taken from the Eclipse Helios distribution):
When selecting the project and choosing "Run As > JUnit Plug-In Test" from the context-menu, we get:
An internal error occurred during: "Launching Testing".
with this stack trace:
and these Session Data:
If we comment out the line
the the test starts and runs. (However, the test itself fails as expected.)
We use Eclipse Helios (3.6) SR1 and have created a single bundle project with only one Scala source file:
package org.example.test
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
// If this import is removed, the problem disappears.
// (But the test then fails as expected.)
import org.scalacheck.Arbitrary._
@RunWith(classOf[JUnitRunner])
class Testing
The project has this manifest:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Testing
Bundle-SymbolicName: Testing
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.scala-ide.scala.library,
com.maconomy.org.scalacheck;bundle-version="1.8.0",
com.maconomy.org.scalatest;bundle-version="1.2.0",
org.junit;bundle-version="4.8.1"
We use a custom target platform with a number of folders (taken from the Eclipse Helios distribution):
- org.junit4_4.8.1.v20100525/
- org.junit_4.8.1.v4_8_1_v20100427-1100/
- com.maconomy.org.scalacheck_2.8.0-1.8-SNAPSHOT.jar
- com.maconomy.org.scalatest-1.2.jar
- org.eclipse.core.contenttype_3.4.100.v20100505-1235.jar
- org.eclipse.core.jobs_3.5.1.R36x_v20100824.jar
- org.eclipse.core.runtime_3.6.0.v20100505.jar
- org.eclipse.equinox.app_1.3.1.R36x_v20100803.jar
- org.eclipse.equinox.common_3.6.0.v20100503.jar
- org.eclipse.equinox.preferences_3.3.0.v20100503.jar
- org.eclipse.equinox.registry_3.5.0.v20100503.jar
- org.eclipse.osgi_3.6.1.R36x_v20100806.jar
- org.hamcrest.core_1.1.0.v20090501071000.jar
- org.scala-ide.scala.library_2.8.1.RC2-p0002.jar
When selecting the project and choosing "Run As > JUnit Plug-In Test" from the context-menu, we get:
An internal error occurred during: "Launching Testing".
with this stack trace:
java.lang.NullPointerException
at org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.resolveStatements(ConstructorDeclaration.java:471)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:410)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1147)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1235)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:540)
at org.eclipse.jdt.internal.core.hierarchy.HierarchyResolver.resolve(HierarchyResolver.java:793)
at org.eclipse.jdt.internal.core.hierarchy.RegionBasedHierarchyBuilder.createTypeHierarchyBasedOnRegion(RegionBasedHierarchyBuilder.java:90)
at org.eclipse.jdt.internal.core.hierarchy.RegionBasedHierarchyBuilder.build(RegionBasedHierarchyBuilder.java:59)
at org.eclipse.jdt.internal.core.hierarchy.RegionBasedTypeHierarchy.compute(RegionBasedTypeHierarchy.java:97)
at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.refresh(TypeHierarchy.java:1263)
at org.eclipse.jdt.internal.core.CreateTypeHierarchyOperation.executeOperation(CreateTypeHierarchyOperation.java:90)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:788)
at org.eclipse.jdt.core.JavaCore.newTypeHierarchy(JavaCore.java:3944)
at org.eclipse.jdt.internal.junit.launcher.JUnit4TestFinder.findTestsInContainer(JUnit4TestFinder.java:128)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.evaluateTests(JUnitLaunchConfigurationDelegate.java:260)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launch(JUnitLaunchConfigurationDelegate.java:125)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:702)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:923)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1126)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
and these Session Data:
eclipse.buildId=M20100909-0800
java.version=1.6.0_22
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=da_DK
Framework arguments: -product org.eclipse.epp.package.modeling.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.modeling.product
If we comment out the line
import org.scalacheck.Arbitrary._
the the test starts and runs. (However, the test itself fails as expected.)
on 2010-12-01 01:31 *
By David Bernard
(In revision:c8a5f49f3725baa6a3ecc25c77a43536ef331490) try to fix (at least log via Defensive) definition of invalid source range start/end (may be some bugs could be introducted instead of fixing, Can someone review (especially comments and application of -1) ?
see #2785, see #1000158
Branch:wip_exp_backport
see #2785, see #1000158
Branch:wip_exp_backport
Updating tickets (#3255, #3262, #3271, #3277, #3279, #3287, #3313, #3317, #3318, #3320, #3329, #1000000, #1000002, #1000004, #1000005, #1000007, #1000011, #1000013, #1000018, #1000019, #1000020, #1000022, #1000023, #1000024, #1000025, #1000026, #1000028, #1000031, #1000033, #1000034, #1000037, #1000039, #1000040, #1000041, #1000057, #1000058, #1000060, #1000061, #1000063, #1000064, #1000065, #1000067, #1000070, #1000073, #1000076, #1000080, #1000082, #1000083, #1000084, #1000085, #1000087, #1000088, #1000089, #1000090, #1000092, #1000093, #1000094, #1000095, #1000097, #1000102, #1000104, #1000106, #1000108, #1000110, #1000111, #1000116, #1000124, #1000126, #1000127, #1000129, #1000132, #1000133, #1000136, #1000139, #1000143, #1000144, #1000145, #1000148, #1000149, #1000152, #1000154, #1000155, #1000157, #1000158, #1000159, #1000161, #1000169, #1000170, #1000172, #1000174, #1000176, #1000178, #1000179, #1000183, #1000185, #1000188, #1000189, #1000192, #1000196, #1000198)