Community
Participate
Working Groups
System setup: Gradle testCompile("org.junit.jupiter:junit-jupiter:5.4.1") which bundles junit-jupiter-params-5.1.1.jar Description: When using junit-params' org.junit.jupiter.params.provider.MethodSource in a class one of the following Exceptions are thrown: 1) !ENTRY org.eclipse.core.resources 4 2 2019-04-03 14:28:07.120 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources". !STACK 0 java.lang.ClassCastException: org.eclipse.jdt.internal.compiler.ast.BinaryExpression cannot be cast to org.eclipse.jdt.internal.compiler.ast.StringLiteral at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.getJUnitMethodSourceValue(TypeDeclaration.java:796) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.getJUnitMethodSourceValues(TypeDeclaration.java:785) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.internalAnalyseCode(TypeDeclaration.java:751) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode(TypeDeclaration.java:271) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:130) at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:898) at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:145) at java.lang.Thread.run(Thread.java:748) 2) !ENTRY org.eclipse.jdt.core.manipulation 4 0 2019-04-03 14:35:52.631 !MESSAGE Error in JDT Core during AST creation !STACK 0 java.lang.ClassCastException: org.eclipse.jdt.internal.compiler.ast.BinaryExpression cannot be cast to org.eclipse.jdt.internal.compiler.ast.StringLiteral at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.getJUnitMethodSourceValue(TypeDeclaration.java:796) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.getJUnitMethodSourceValues(TypeDeclaration.java:785) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.internalAnalyseCode(TypeDeclaration.java:751) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode(TypeDeclaration.java:271) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:130) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1252) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:714) at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1212) at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:827) at org.eclipse.jdt.core.manipulation.CoreASTProvider$1.run(CoreASTProvider.java:271) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at org.eclipse.jdt.core.manipulation.CoreASTProvider.createAST(CoreASTProvider.java:263) at org.eclipse.jdt.core.manipulation.CoreASTProvider.getAST(CoreASTProvider.java:196) at org.eclipse.jdt.core.manipulation.SharedASTProviderCore.getAST(SharedASTProviderCore.java:138) at org.eclipse.jdt.internal.ui.text.correction.AssistContext.getASTRoot(AssistContext.java:128) at org.eclipse.jdt.internal.ui.text.java.hover.ProblemHover$ProblemInfo.getJavaAnnotationFixes(ProblemHover.java:101) at org.eclipse.jdt.internal.ui.text.java.hover.ProblemHover$ProblemInfo.getCompletionProposals(ProblemHover.java:79) at org.eclipse.jdt.internal.ui.text.java.hover.AbstractAnnotationHover$AnnotationInformationControl.deferredCreateContent(AbstractAnnotationHover.java:305) at org.eclipse.jdt.internal.ui.text.java.hover.AbstractAnnotationHover$AnnotationInformationControl.setInput(AbstractAnnotationHover.java:192) at org.eclipse.jface.text.AbstractInformationControlManager.internalShowInformationControl(AbstractInformationControlManager.java:1151) at org.eclipse.jface.text.AbstractInformationControlManager.presentInformation(AbstractInformationControlManager.java:1120) at org.eclipse.jface.text.AbstractHoverInformationControlManager.presentInformation(AbstractHoverInformationControlManager.java:884) at org.eclipse.jface.text.TextViewerHoverManager.doPresentInformation(TextViewerHoverManager.java:251) at org.eclipse.jface.text.TextViewerHoverManager.lambda$0(TextViewerHoverManager.java:241) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3919) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3550) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155) at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:566) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:155) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:661) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:597) at org.eclipse.equinox.launcher.Main.run(Main.java:1476) 3) !ENTRY org.eclipse.jdt.ui 4 0 2019-04-03 14:49:42.443 !MESSAGE Error in JDT Core during reconcile !STACK 1 Java Model Exception: java.lang.ClassCastException at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:324) at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:346) at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:193) at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:94) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:736) at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:802) at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1322) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:131) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.access$0(JavaReconcilingStrategy.java:113) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:93) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:90) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:157) at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:92) at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:107) at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:76) at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:210) Caused by: java.lang.ClassCastException Caused by: java.lang.ClassCastException !SUBENTRY 1 org.eclipse.jdt.core 4 1005 2019-04-03 14:49:42.443 !MESSAGE java.lang.ClassCastException !STACK 0 java.lang.ClassCastException I have tried with other versions of junit.params, like junit-jupiter-params-5.1.1.jar, to no avail.
Espen, do you happen to use some value like "foo"+"bar" in your @MethodSource annotation? If so, does avoiding this concatenation inside the annotation succeed to work around the problem? Pierre-Yves, can you have a look?
Yes, that actually does seem to be a acceptable workaround. I had defined the classname for the source methods as final to be reused. ###EXAMPLE: private final String TEST_DATA_CLASS = "foo"; @ParameterizedTest @MethodSource(TEST_DATA_CLASS + "#foo") public void someTest() { } @ParameterizedTest @MethodSource(TEST_DATA_CLASS + "#bar") public void someOtherTest() { } #### And this seems to screw things up. The interesting thing is that if I commented out the @MethodSource annotation, the compiler still complained about the _import_ of the MethodSource :)
Thanks for reporting this, I'll take a look.
New Gerrit change created: https://git.eclipse.org/r/140074
Is this still considered for M1 or should we target M3?
(In reply to Jay Arthanareeswaran from comment #5) > Is this still considered for M1 or should we target M3? Fix essentially looks fine, but still I dropped an additional request into gerrit => scheduling the improved fix for M3.
Stupid question - out of interest, why is M2 "skipped"?
(In reply to Pierre-Yves B. from comment #7) > Stupid question - out of interest, why is M2 "skipped"? We won't do a full M2 test & fix week but will contribute the last good I-build to the M2 release train.
Gerrit change https://git.eclipse.org/r/140074 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=c24ff998cff3b45210a73fb4067fd17d8ee731dc
(In reply to Eclipse Genie from comment #9) > Gerrit change https://git.eclipse.org/r/140074 was merged to [master]. > Commit: > http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/ > ?id=c24ff998cff3b45210a73fb4067fd17d8ee731dc Released for 4.12 M3 Thanks, Pierre-Yves!
Thanks for the review and the feedback on the patch! :)
I noticed a new test failure in our back-to-back tests with javac [1] Since we have a "normal" compile error, the excuse for comparison is bogus in this particular test. Fixed via https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=b150a823927c3586fa8e11a2cb098c3e2dbbc1e5 [1] https://ci.eclipse.org/jdt/job/eclipse.jdt.core-run.javac-1.8/97/testReport/org.eclipse.jdt.core.tests.compiler.regression/AnnotationTest/testBug546084b___1_8/
*** Bug 547378 has been marked as a duplicate of this bug. ***
Looks like I've hit this. I'd upgraded to Gradle 5.4.1 (for some long wished-for Buildship functionality) then today I tried jumping from Eclipse 4.10 -> 4.12-M1 then back to 4.11, and it still persisted. Just wondering if anyone has wisdom to share: Would I be better going right back to 4.10, or forwards to try a nightly with this fix? A key factor is wanting to test out JDK 11 (jumping from 8) so I'd keen to hear if there's any known-issues or benefits with either choice. Thanks for the prompt fix!
4.12-M3 will be released on May 24th. Just a tiny bit more patience and you'll benefit from the fix. Alternatively, you can give the nightly builds a try. ;)
Ah great, thanks for the date pointer. I'd thought from the M2 comment that it would be ~ 3-4 weeks away.
Verified for 4.12 M3 using build I20190520-1805