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

858 incorporate new parser into core #868

Merged
merged 27 commits into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4157012
Fix parsing duplicate pom files
fabapp2 Sep 12, 2023
791e4ae
Refactoring
fabapp2 Sep 13, 2023
422bb1b
Add test proving duplicate parsing of resources
fabapp2 Sep 13, 2023
0bdbc75
Fix path calculcation to other modules
fabapp2 Sep 13, 2023
73a1a56
Back to use shrinkwrap in tests
fabapp2 Sep 12, 2023
9f84403
Replace single-line with multi-line String
fabapp2 Sep 12, 2023
8b35016
Bumped maven-resolver.version
fabapp2 Sep 12, 2023
cbff488
Fix test allow SbmCoreConfig construct ExecutionContext
fabapp2 Sep 12, 2023
e1de318
GH Action
fabapp2 Sep 12, 2023
debfeb2
Assert correct classpath
fabapp2 Sep 13, 2023
0d29d98
Fix testdata
fabapp2 Sep 13, 2023
be4c511
Cleanup
fabapp2 Sep 13, 2023
cd94a87
Disabled test that must be reactivated later
fabapp2 Sep 13, 2023
7ff206d
Move JavaSourceUtil to sbm-support-rewrite
fabapp2 Sep 13, 2023
22a8ff0
Move OpenRewriteTestSupport to test-helper
fabapp2 Sep 13, 2023
62154af
Back to use shrinkwrap in tests
fabapp2 Sep 12, 2023
c22b84b
Add missing test projects
fabapp2 Sep 13, 2023
6bd2c24
Back to use shrinkwrap in tests
fabapp2 Sep 12, 2023
002fb76
Merge branch '858-incorporate-new-parser-into-core' into revamp/move-…
fabapp2 Sep 13, 2023
31724f8
merged with 858
fabapp2 Sep 20, 2023
3682dee
Revamp/move open rewrite test support to test helper (#939)
fabapp2 Sep 20, 2023
a7b8155
Merge remote-tracking branch 'origin/858-incorporate-new-parser-into-…
fabapp2 Sep 20, 2023
800f34f
Revamp/make other modules compile (#943)
fabapp2 Sep 24, 2023
f376252
Using shrinkwrap depchain dependency
fabapp2 Sep 24, 2023
f300b89
Replace single line with multi line string
fabapp2 Sep 24, 2023
084872b
Cleanup properties order
fabapp2 Sep 24, 2023
8abece3
Merge branch 'version/revamp' into 858-incorporate-new-parser-into-core
fabapp2 Sep 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public interface JavaSource extends ProjectResource {
* <p>
* Be careful if the given {@code Recipe} affects more than the wrapped compilation unit YOU MUST CALL {@link JavaSourceSet.apply(..)}
*/
void apply(Recipe recipe);
void apply(Recipe... recipe);

/**
* Retrieve the {@code Type} declared in this {@code JavaSource}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public interface Type {

Annotation getAnnotation(String fqName);

void apply(Recipe r);
void apply(Recipe... r);

boolean hasMethod(String methodPattern);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ public Annotation getAnnotation(String fqName) {
}

@Override
public void apply(Recipe r) {

public void apply(Recipe... r) {
throw new UnsupportedOperationException();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ public <T> void replaceLiteral(Class<T> klass, LiteralTransformer<T> t) {
refactoring.refactor(getResource(), new ReplaceLiteralVisitor<>(klass, t));
}


@Override
public String toString() {
return "OpenRewriteJavaSource(" + getAbsolutePath() + ")";
Expand All @@ -181,7 +180,7 @@ public String toString() {
* {@inheritDoc}
*/
@Override
public void apply(Recipe recipe) {
public void apply(Recipe... recipe) {
refactoring.refactor(getResource(), recipe);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public String toString() {
}

@Override
public void apply(Recipe r) {
public void apply(Recipe... r) {
refactoring.refactor(rewriteSourceFileHolder, r);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ public class RetrieveAnnotationTypeTest {
@Test
void retrieveAnnotation() {
String javaSource =
"import javax.ejb.Stateless;\n" +
"@Stateless\n" +
"public class MyClass {" +
"}";
"""
import javax.ejb.Stateless;
@Stateless
public class MyClass { }
""";

// String mavenRepo = System.getProperty("user.home") + "/.m2/repository";
// List<Path> paths = JavaParser.dependenciesFromClasspath("ejb-api");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,31 @@ public class GetImplementsTest {
@Test
void test() {
String businessInterface =
"package com.example.jee.app.ejb.local;\n" +
"\n" +
"import javax.ejb.Local;\n" +
"\n" +
"@Local\n" +
"public interface ABusinessInterface {\n" +
" String businessMethod();\n" +
"}";
"""
package com.example.jee.app.ejb.local;

import javax.ejb.Local;

@Local
public interface ABusinessInterface {
String businessMethod();
}
""";

String ejb =
"package com.example.jee.app.ejb.local;\n" +
"\n" +
"import javax.ejb.Stateless;\n" +
"\n" +
"@Stateless\n" +
"public class ABean implements ABusinessInterface {\n" +
"\n" +
" @Override\n" +
" public String businessMethod() {\n" +
" return \"A\";\n" +
" }\n" +
"}";
"""
package com.example.jee.app.ejb.local;

import javax.ejb.Stateless;

@Stateless
public class ABean implements ABusinessInterface {
@Override
public String businessMethod() {
return "A";
}
}
""";

List<J.CompilationUnit> compilationUnitsFromStrings = OpenRewriteTestSupport.createCompilationUnitsFromStrings(List.of("javax.ejb:javax.ejb-api:3.2"), businessInterface, ejb);

Expand Down
5 changes: 3 additions & 2 deletions components/sbm-recipes-boot-upgrade/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencies>
Expand Down Expand Up @@ -73,6 +73,7 @@
<dependency>
<groupId>org.springframework.sbm</groupId>
<artifactId>recipe-test-support</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public String getDescription() {
}

@Override
protected TreeVisitor<?, ExecutionContext> getVisitor() {
public TreeVisitor<?, ExecutionContext> getVisitor() {

return new PropertiesVisitor<ExecutionContext>() {

Expand Down

This file was deleted.

Loading