-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 4660-support-jep-440-and-441
- Loading branch information
Showing
57 changed files
with
3,238 additions
and
483 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26 | ||
distributionSha256Sum=57dafb5c2622c6cc08b993c85b7c06956a2f53536432a30ead46166dbca0f1e9 |
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
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
66 changes: 66 additions & 0 deletions
66
rewrite-core/src/main/java/org/openrewrite/SourceFileWithReferences.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,66 @@ | ||
/* | ||
* Copyright 2024 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; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.jspecify.annotations.Nullable; | ||
import org.openrewrite.trait.Reference; | ||
|
||
import java.util.*; | ||
|
||
@Incubating(since = "8.39.0") | ||
public interface SourceFileWithReferences extends SourceFile { | ||
|
||
References getReferences(); | ||
|
||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Getter | ||
class References { | ||
private final SourceFile sourceFile; | ||
private final Set<Reference> references; | ||
|
||
public Collection<Reference> findMatches(Reference.Matcher matcher) { | ||
return findMatchesInternal(matcher, null); | ||
} | ||
|
||
public Collection<Reference> findMatches(Reference.Matcher matcher, Reference.Kind kind) { | ||
return findMatchesInternal(matcher, kind); | ||
} | ||
|
||
private List<Reference> findMatchesInternal(Reference.Matcher matcher, Reference.@Nullable Kind kind) { | ||
List<Reference> list = new ArrayList<>(); | ||
for (Reference ref : references) { | ||
if ((kind == null || ref.getKind().equals(kind)) && ref.matches(matcher) ) { | ||
list.add(ref); | ||
} | ||
} | ||
return list; | ||
} | ||
|
||
public static References build(SourceFile sourceFile) { | ||
Set<Reference> references = new HashSet<>(); | ||
ServiceLoader<Reference.Provider> loader = ServiceLoader.load(Reference.Provider.class); | ||
loader.forEach(provider -> { | ||
if (provider.isAcceptable(sourceFile)) { | ||
references.addAll(provider.getReferences(sourceFile)); | ||
} | ||
}); | ||
return new References(sourceFile, references); | ||
} | ||
} | ||
} |
57 changes: 0 additions & 57 deletions
57
rewrite-core/src/main/java/org/openrewrite/SourceFileWithTypeReferences.java
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
rewrite-core/src/main/java/org/openrewrite/TypeReferenceProvider.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.