Comments (7)
Hi @ylemoigne ; thanks for trying out the latest version released today before reporting your issue here; really appreciated!
I'm looking at the stacktrace and the associated class, but I'm not seeing any recent changes there that might factor in:
https://github.com/openrewrite/rewrite/commits/v8.11.2/rewrite-java/src/main/java/org/openrewrite/java/format/TabsAndIndentsVisitor.java
A couple of questions as I don't yet have enough of a lead to troubleshoot this.
- Is there any indication of what file it stumbles over?
- Would you be able to share part of that file with us?
- Is there any style configuration on your part that might factor in?
- And what recipe did you run to trigger this?
from rewrite.
Hi @timtebeek
Yes there is an indication of what is the java source file but sadly, I'm not able to share it with anyone (legal stuff).
No style, here the whole config I'm using :
rewrite {
activeRecipe("org.openrewrite.java.RemoveUnusedImports")
activeRecipe("org.openrewrite.java.OrderImports")
}
I know that without the file that raise this issue it's hard to debug for you, I'm sorry.
from rewrite.
Not having access to that file sure makes it a challenge indeed to know if this has been solved somewhere down the line.
Would you be able to on your own machine (only) create a unit test for either of those recipes containing your class?
You can place that test either in OrderImportsTest
Or in RemoveUnusedImportsTest
If that indeed reproduces the issue for you, then you can gradually strip away as much as possible, until there's a minimum left to replicate the issue in a manner you can hopefully share. Any help there would be appreciated, as we'd like to see this resolved for you, but our options are limited without that access to the failed file.
from rewrite.
I'm not sure how it works.
If I try to replace the string in multipleClassesWithTheSameNameButDifferentPackages
to
java(
"""
package foo;
public class Toto extends Foo {
}
"""
)
The test already fail.
java.lang.IllegalStateException: LST contains missing or invalid type information
Identifier->ClassDeclaration->CompilationUnit
/*~~(Identifier type is missing or malformed)~~>*/Foo
at org.openrewrite.java.Assertions.assertValidTypes(Assertions.java:87)
It seems that it need to know all dependencies. If it's true, I don't know how to provide it. (And I hope that's not too hard, the source file causing issue is 1600 lines long and have a lot of dependend types 😅 )
from rewrite.
To fix that particular problem you can just disable all type validation like so:
from rewrite.
Perhaps it helps to ignore type validation options for your recipe, although that would also affect the remove imports recipe.
@Test
void foo() {
rewriteRun(
spec -> spec.recipe(new RemoveUnusedImports()).typeValidationOptions(TypeValidation.none()),
java(
"""
import java.awt.List;
import java.util.List;
class Test {}
"""
)
);
}
from rewrite.
On my project, the minimal setup to have the exception is :
rewrite {
activeRecipe("org.openrewrite.java.OrderImports")
}
So in OrderImportsTest
, I wrote :
@Issue("https://github.com/openrewrite/rewrite/issues/3821")
@Test
void unidenfiedIssue() {
String content;
try {
content = Files.readString(
Paths.get("/pathTo/Culprit.java"), // Culprit designated by "Error while visiting `theClassFullyQualifiedName`"
StandardCharsets.UTF_8);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
rewriteRun(
spec -> spec.typeValidationOptions(TypeValidation.none()),
java(content)
);
}
The test run end with The recipe must not make changes to ...
I don't understand why it don't crash before in the the test.
I have checked out the v8.11.2
tag (commit: cba6919), I've run the test with the same JVM I use to build my projet (temurin 11)
I don't know how to go further :/
from rewrite.
Related Issues (20)
- Migrate to httpclient5 after relocation HOT 1
- Add glob curly-brace support to FindSourceFiles HOT 6
- MethodInvocation#withName replaces `<constructor>` HOT 1
- Allow partial update of maven plugin configuration HOT 4
- UpdateMavenModel does not handle valid XML properly HOT 8
- Add a recipe for converting Gradle scripts from Groovy DSL (`.gradle`) to Kotlin DSL (`.gradle.kts`) HOT 2
- `Jenkinsfile` changed by `UpgradeToJava17` / `RemoveTrailingWhitespace` recipes HOT 4
- 🐛 Cannot read properties of undefined (reading 'organization') HOT 6
- `Invalid parameter name ""` when running on Java 8 HOT 3
- Add `@IncubatingNextRelease` that is automatically replaced with `@Incubating(since="...")` when release is cut HOT 6
- Maven: Add ChangeManagedDependencyClassifier HOT 1
- RemoveDuplicateDependencies - Remove Maven dependency even if classifier is different HOT 3
- Enhance TypeTree.build to parse whitespace in escaped names into identifier.
- Add negation support to FindSourceFiles
- GroovyParser error: Empty map literal test is disabled. HOT 1
- Enhancement: Add annotations to `JavaType$Array`.
- MergeYaml recipe fileMatcher property is present in 7.x version but removed in 8.x versions HOT 9
- NoWhitespaceAfter trims whitespace after annotations for arrays (there should be a single space in-between the annotation an []) HOT 2
- 8.13 regression: ShortenFullyQualifiedTypeReferences breaks code when type annotation meets qualified type HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rewrite.