Running a single test in /org.eclipse.jdt.core.tests.compiler/ with a 1.5 jre ? [message #250639] |
Sun, 13 January 2008 10:03  |
Eclipse User |
|
|
|
Originally posted by: 1.2.3
Hi,
i've added a compiler test in
/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/cor e/tests/compiler/regression
.. I need to make it run with jdk 1.5 (the test uses annotations).
I've put this in the test:
public static Test suite() {
return buildMinimalComplianceTestSuite(testClass(), F_1_5);
}
If i compile the following projects with default prefs (J2SE-1.4
Environment):
/org.eclipse.jdt.core
/org.eclipse.jdt.core.tests.compiler
/org.eclipse.test.performance
And i launch "Debug -> JUnit Test" from my test class, i get:
Cannot run
org.eclipse.jdt.core.tests.compiler.regression.NonNullAnnota tionTest at
compliance 1.3!
Cannot run
org.eclipse.jdt.core.tests.compiler.regression.NonNullAnnota tionTest at
compliance 1.4!
So i tried to modify the launch config to use Jdk 1.5, but i got plenty
of these:
junit.framework.AssertionFailedError: Unexpected target error running
resulting class file for org/NonNull.java:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/eclipse/jdt/core/tests/util/VerifyTests
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.assertTrue(Assert.java:20)
at
org.eclipse.jdt.core.tests.compiler.regression.AbstractRegre ssionTest.runConformTest(AbstractRegressionTest.java:682)
at
org.eclipse.jdt.core.tests.compiler.regression.AbstractRegre ssionTest.runConformTest(AbstractRegressionTest.java:540)
at
org.eclipse.jdt.core.tests.compiler.regression.NonNullAnnota tionTest.test_validNonNullAnnotation(NonNullAnnotationTest.j ava:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
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:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:2 4)
at junit.extensions.TestDecorator.run(TestDecorator.java:30)
at
org.eclipse.jdt.core.tests.util.CompilerTestSetup.run(Compil erTestSetup.java:48)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer ence.run(JUnit3TestReference.java:130)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:196)
So i tried to build the 3 projects with JDK 1.5 (by modifying the
prefs), but i get the same error.
The test method from wich i get the dumped exception is this:
public void test_validNonNullAnnotation() {
if (this.complianceLevel >= ClassFileConstants.JDK1_5) {
this.runConformTest(
new String[] {
"org/NonNull.java",
"package org;\n" +
"public @interface NonNull { }\n",
"X.java",
"public class X {\n" +
" @org.NonNull Object foo() {\n" +
" return new Object();\n" +
" }\n" +
"}\n"
},
"");
}
}
So could you please tell me what i must do to run the test with a 1.5 jre?
TIA
|
|
|
Re: Running a single test in /org.eclipse.jdt.core.tests.compiler/ with a 1.5 jre ? [message #250688 is a reply to message #250639] |
Tue, 15 January 2008 04:45   |
Eclipse User |
|
|
|
I guess your launch configuration is currently using your workspace JRE default
which should be an 1.4 VM... So, you just java to modify the Runtime JRE
in the 'Main' tab of your launch config to an 1.5 VM and it should work.
To avoid the messages "Cannot run ... at compliance 1.x" you can
also specify -Dcompliance=1.5 in the VM arguments. Then the test
will be run only at the 1.5 level...
1 wrote:
> Hi,
>
> i've added a compiler test in
> /org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/cor e/tests/compiler/regression
> .. I need to make it run with jdk 1.5 (the test uses annotations).
>
> I've put this in the test:
>
> public static Test suite() {
> return buildMinimalComplianceTestSuite(testClass(), F_1_5);
> }
>
>
> If i compile the following projects with default prefs (J2SE-1.4
> Environment):
>
> /org.eclipse.jdt.core
> /org.eclipse.jdt.core.tests.compiler
> /org.eclipse.test.performance
>
> And i launch "Debug -> JUnit Test" from my test class, i get:
>
> Cannot run
> org.eclipse.jdt.core.tests.compiler.regression.NonNullAnnota tionTest at
> compliance 1.3!
> Cannot run
> org.eclipse.jdt.core.tests.compiler.regression.NonNullAnnota tionTest at
> compliance 1.4!
>
> So i tried to modify the launch config to use Jdk 1.5, but i got plenty
> of these:
>
> junit.framework.AssertionFailedError: Unexpected target error running
> resulting class file for org/NonNull.java:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/eclipse/jdt/core/tests/util/VerifyTests
>
> at junit.framework.Assert.fail(Assert.java:47)
> at junit.framework.Assert.assertTrue(Assert.java:20)
> at
> org.eclipse.jdt.core.tests.compiler.regression.AbstractRegre ssionTest.runConformTest(AbstractRegressionTest.java:682)
>
> at
> org.eclipse.jdt.core.tests.compiler.regression.AbstractRegre ssionTest.runConformTest(AbstractRegressionTest.java:540)
>
> at
> org.eclipse.jdt.core.tests.compiler.regression.NonNullAnnota tionTest.test_validNonNullAnnotation(NonNullAnnotationTest.j ava:44)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:164)
> at junit.framework.TestCase.runBare(TestCase.java:130)
> 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:120)
> at junit.framework.TestSuite.runTest(TestSuite.java:230)
> at junit.framework.TestSuite.run(TestSuite.java:225)
> at junit.extensions.TestDecorator.basicRun(TestDecorator.java:2 4)
> at junit.extensions.TestDecorator.run(TestDecorator.java:30)
> at
> org.eclipse.jdt.core.tests.util.CompilerTestSetup.run(Compil erTestSetup.java:48)
>
> at junit.framework.TestSuite.runTest(TestSuite.java:230)
> at junit.framework.TestSuite.run(TestSuite.java:225)
> at junit.framework.TestSuite.runTest(TestSuite.java:230)
> at junit.framework.TestSuite.run(TestSuite.java:225)
> at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer ence.run(JUnit3TestReference.java:130)
>
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:196)
>
>
>
> So i tried to build the 3 projects with JDK 1.5 (by modifying the
> prefs), but i get the same error.
>
> The test method from wich i get the dumped exception is this:
>
> public void test_validNonNullAnnotation() {
> if (this.complianceLevel >= ClassFileConstants.JDK1_5) {
> this.runConformTest(
> new String[] {
> "org/NonNull.java",
> "package org;\n" +
> "public @interface NonNull { }\n",
> "X.java",
> "public class X {\n" +
> " @org.NonNull Object foo() {\n" +
> " return new Object();\n" +
> " }\n" +
> "}\n"
> },
> "");
> }
> }
>
> So could you please tell me what i must do to run the test with a 1.5 jre?
>
> TIA
>
>
|
|
|
Re: Running a single test in /org.eclipse.jdt.core.tests.compiler/ with a 1.5 jre ? [message #250698 is a reply to message #250688] |
Wed, 16 January 2008 07:40  |
Eclipse User |
|
|
|
Originally posted by: none.domain.invalid
Frederic Fusier a écrit :
> I guess your launch configuration is currently using your workspace JRE
> default
> which should be an 1.4 VM... So, you just java to modify the Runtime JRE
> in the 'Main' tab of your launch config to an 1.5 VM and it should work.
>
> To avoid the messages "Cannot run ... at compliance 1.x" you can
> also specify -Dcompliance=1.5 in the VM arguments. Then the test
> will be run only at the 1.5 level...
Thanks, it works :)
|
|
|
Powered by
FUDForum. Page generated in 0.02837 seconds