Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4 new jdt.ui + jdt.ui.refactoring fails since I20240722-0320 #1526

Closed
iloveeclipse opened this issue Jul 22, 2024 · 10 comments
Closed

4 new jdt.ui + jdt.ui.refactoring fails since I20240722-0320 #1526

iloveeclipse opened this issue Jul 22, 2024 · 10 comments
Labels
bug Something isn't working regression Regression defect
Milestone

Comments

@iloveeclipse
Copy link
Member

Following tests

  • CleanUpTest16.testOneIfWithPatternInstanceof
  • MoveInnerToTopLevelTests16.test_Bug572639_2
  • SurroundWithTests16.testBug566949_1
  • SurroundWithTests16.testBug566949_2

fail since I20240722-0320 on all platforms.

Regression from eclipse-jdt/eclipse.jdt.core#2688 / commit 8e630b6c235edaf7d6e757442b1ee2c5761b6021.

class org.eclipse.jdt.core.dom.VariableDeclarationFragment cannot be cast to class org.eclipse.jdt.core.dom.SingleVariableDeclaration (org.eclipse.jdt.core.dom.VariableDeclarationFragment and org.eclipse.jdt.core.dom.SingleVariableDeclaration are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @597903fc)

java.lang.ClassCastException: class org.eclipse.jdt.core.dom.VariableDeclarationFragment cannot be cast to class org.eclipse.jdt.core.dom.SingleVariableDeclaration (org.eclipse.jdt.core.dom.VariableDeclarationFragment and org.eclipse.jdt.core.dom.SingleVariableDeclaration are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @597903fc)
at org.eclipse.jdt.core.dom.TypePattern.getPatternVariable(TypePattern.java:243)
at org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryCatchAnalyzer$1.visit(SurroundWithTryCatchAnalyzer.java:104)
at org.eclipse.jdt.core.dom.PatternInstanceofExpression.accept0(PatternInstanceofExpression.java:212)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:3391)
at org.eclipse.jdt.core.dom.ParenthesizedExpression.accept0(ParenthesizedExpression.java:131)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:3391)
at org.eclipse.jdt.core.dom.PrefixExpression.accept0(PrefixExpression.java:253)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:3391)
at org.eclipse.jdt.core.dom.IfStatement.accept0(IfStatement.java:181)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
at org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryCatchAnalyzer.getVariableStatementBinding(SurroundWithTryCatchAnalyzer.java:80)
at org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryCatchRefactoring.findEndPosition(SurroundWithTryCatchRefactoring.java:477)
at org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryCatchRefactoring.createTryCatchStatement(SurroundWithTryCatchRefactoring.java:404)
at org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryCatchRefactoring.createChange(SurroundWithTryCatchRefactoring.java:231)
at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:119)
at org.eclipse.ltk.core.refactoring.PerformRefactoringOperation.run(PerformRefactoringOperation.java:124)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:41)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:739)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2452)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2477)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:6136)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:6092)
at org.eclipse.jdt.ui.tests.refactoring.AbstractJunit4SelectionTestCase.performTest(AbstractJunit4SelectionTestCase.java:136)
at org.eclipse.jdt.ui.tests.refactoring.SurroundWithTests.performTest(SurroundWithTests.java:53)
at org.eclipse.jdt.ui.tests.refactoring.SurroundWithTests16.tryCatchTest(SurroundWithTests16.java:58)
at org.eclipse.jdt.ui.tests.refactoring.SurroundWithTests16.testBug566949_2(SurroundWithTests16.java:68)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
Error on /TestSetupProject16/src/test1/E.java

java.lang.RuntimeException: Error on /TestSetupProject16/src/test1/E.java
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1063)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:740)
at org.eclipse.jdt.core.dom.CompilationUnitResolver$ECJCompilationUnitResolver.resolve(CompilationUnitResolver.java:112)
at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:968)
at org.eclipse.jdt.internal.corext.dom.ASTBatchParser.createASTs(ASTBatchParser.java:83)
at org.eclipse.jdt.internal.corext.fix.CleanUpRefactoring$CleanUpFixpointIterator.next(CleanUpRefactoring.java:400)
at org.eclipse.jdt.internal.corext.fix.CleanUpRefactoring.cleanUpProject(CleanUpRefactoring.java:683)
at org.eclipse.jdt.internal.corext.fix.CleanUpRefactoring.checkFinalConditions(CleanUpRefactoring.java:643)
at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:163)
at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:82)
at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:116)
at org.eclipse.ltk.core.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:207)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2452)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2472)
at org.eclipse.jdt.ui.tests.quickfix.CleanUpTestCase.executePerformOperation(CleanUpTestCase.java:317)
at org.eclipse.jdt.ui.tests.quickfix.CleanUpTestCase.performRefactoring(CleanUpTestCase.java:283)
at org.eclipse.jdt.ui.tests.quickfix.CleanUpTestCase.performRefactoring(CleanUpTestCase.java:263)
at org.eclipse.jdt.ui.tests.quickfix.CleanUpTestCase.assertRefactoringResultAsExpected(CleanUpTestCase.java:184)
at org.eclipse.jdt.ui.tests.quickfix.CleanUpTest16.testOneIfWithPatternInstanceof(CleanUpTest16.java:404)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
Caused by: java.lang.ClassCastException: class org.eclipse.jdt.core.dom.VariableDeclarationFragment cannot be cast to class org.eclipse.jdt.core.dom.SingleVariableDeclaration (org.eclipse.jdt.core.dom.VariableDeclarationFragment and org.eclipse.jdt.core.dom.SingleVariableDeclaration are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @6b72dc69)
at org.eclipse.jdt.core.dom.TypePattern.getPatternVariable(TypePattern.java:243)
at org.eclipse.jdt.internal.corext.fix.OneIfRatherThanDuplicateBlocksThatFallThroughFixCore$OneIfRatherThanDuplicateBlocksThatFallThroughFinder$SuccessiveIfVisitor$PatternNameVisitor.visit(OneIfRatherThanDuplicateBlocksThatFallThroughFixCore.java:109)
at org.eclipse.jdt.core.dom.PatternInstanceofExpression.accept0(PatternInstanceofExpression.java:212)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:3391)
at org.eclipse.jdt.core.dom.IfStatement.accept0(IfStatement.java:181)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
at org.eclipse.jdt.internal.corext.fix.OneIfRatherThanDuplicateBlocksThatFallThroughFixCore$OneIfRatherThanDuplicateBlocksThatFallThroughFinder$SuccessiveIfVisitor.visit(OneIfRatherThanDuplicateBlocksThatFallThroughFixCore.java:83)
at org.eclipse.jdt.core.dom.IfStatement.accept0(IfStatement.java:178)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:3414)
at org.eclipse.jdt.core.dom.Block.accept0(Block.java:128)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
at org.eclipse.jdt.internal.corext.fix.OneIfRatherThanDuplicateBlocksThatFallThroughFixCore$OneIfRatherThanDuplicateBlocksThatFallThroughFinder.visit(OneIfRatherThanDuplicateBlocksThatFallThroughFixCore.java:60)
at org.eclipse.jdt.core.dom.Block.accept0(Block.java:126)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:3391)
at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:677)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:3414)
at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:498)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:3414)
at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:258)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
at org.eclipse.jdt.internal.corext.fix.OneIfRatherThanDuplicateBlocksThatFallThroughFixCore.createCleanUp(OneIfRatherThanDuplicateBlocksThatFallThroughFixCore.java:201)
at org.eclipse.jdt.internal.ui.fix.OneIfRatherThanDuplicateBlocksThatFallThroughCleanUpCore.createFix(OneIfRatherThanDuplicateBlocksThatFallThroughCleanUpCore.java:54)
at org.eclipse.jdt.internal.corext.fix.CleanUpRefactoring.calculateChange(CleanUpRefactoring.java:773)
at org.eclipse.jdt.internal.corext.fix.CleanUpRefactoring$CleanUpASTRequestor.calculateSolutions(CleanUpRefactoring.java:302)
at org.eclipse.jdt.internal.corext.fix.CleanUpRefactoring$CleanUpASTRequestor.acceptAST(CleanUpRefactoring.java:280)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1061)
... 19 more

@subyssurendran666 , @mpalat : please check.

@iloveeclipse iloveeclipse added bug Something isn't working regression Regression defect labels Jul 22, 2024
@iloveeclipse
Copy link
Member Author

@subyssurendran666 , @mpalat : please check. We have M2 this week, it would be nice to have the fix before Thursday.

@carstenartur
Copy link
Contributor

We still cannot run the build without lots of errors.

https://download.eclipse.org/eclipse/downloads/drops4/I20240725-0200/testresults/html/org.eclipse.jdt.ui.tests_ep433I-unit-cen64-gtk3-java17_linux.gtk.x86_64_17.html

Do we have some additional errors now caused by a different issue as before?

@jjohnstn
Copy link
Contributor

I can verify that BindingNamesTest now fails locally. It cannot find X which is a class in the default package. This failure was introduced somewhere after commit f6fe3c8fee3d83b2478db25e where the test works.

@jjohnstn
Copy link
Contributor

I should have clarified that the commit in question is from jdt.core

@iloveeclipse
Copy link
Member Author

Do we have some additional errors now caused by a different issue as before?

Yes, we do, after merging eclipse-jdt/eclipse.jdt.core#2551
I'm working on fixing tests, first batch is #1543

@carstenartur
Copy link
Contributor

I fear removing support for a java version enforces changes in a couple of junit tests in jdt.ui.
In some cases one test for a certain way to process code has been implemented eg in a Java 7 test configuration and another one in Java 8 configuration. Now removing the test for Java 7 is no big deal as this is no longer a valid environment. But the Java 8 based Test configuration might still represent behavior in latest Java versions and should not get lost. Now there is no way to see on a test if it is still representing a valid test case that should be migrated to a Java 17 Test configuration. I guess the Test configuration concept needs a review at least for jdt.ui.

@iloveeclipse
Copy link
Member Author

@jjohnstn : could you please check MoveMembersTests fails?

@jjohnstn
Copy link
Contributor

@iloveeclipse I'll check

@jjohnstn
Copy link
Contributor

Both failures are due to using 1.8 which added the ability to have static members in interfaces (fails < 1.8). I'll put together a fix for the test.

@jjohnstn
Copy link
Contributor

Closing as failures do not occur in 20241027-1800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression Regression defect
Projects
None yet
Development

No branches or pull requests

3 participants