-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue parsing string with Java8ReloadableParser (#4914)
* Fix parser * restore build files * Restore build file * Put arguments on new line for readability * Add test case (even though not reproducible) --------- Co-authored-by: Tim te Beek <[email protected]> Co-authored-by: Knut Wannheden <[email protected]>
- Loading branch information
1 parent
a6afce0
commit c1b258e
Showing
2 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
rewrite-java-tck/src/main/java/org/openrewrite/java/tree/ParserTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2025 the original author or authors. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openrewrite.java.tree; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.openrewrite.Issue; | ||
import org.openrewrite.SourceFile; | ||
import org.openrewrite.java.JavaParser; | ||
import org.openrewrite.test.RewriteTest; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
class ParserTest implements RewriteTest { | ||
|
||
@Test | ||
@Issue("https://github.com/openrewrite/rewrite/pull/4914") | ||
void parseString() throws IOException { | ||
// path needs to be resolvable from `rewrite-java-8` etc. | ||
Path targetFile = Paths.get("../rewrite-java-tck/src/main/java/org/openrewrite/java/tree/ParserTest.java"); | ||
@SuppressWarnings("SimplifyStreamApiCallChains") List<SourceFile> ignore = JavaParser.fromJavaVersion() | ||
.build() | ||
.parse(new String(Files.readAllBytes(targetFile))) | ||
.collect(Collectors.toList()); | ||
} | ||
} |