-
Notifications
You must be signed in to change notification settings - Fork 915
Upgrade Gradle Tooling API 9.3.0-rc-2 #9112
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
base: master
Are you sure you want to change the base?
Changes from all commits
037a9a6
97097a9
3e7d639
90f5409
3229c65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -255,22 +255,7 @@ public enum PropertyKind { | |
| /** | ||
| * Describes a property and its value. | ||
| */ | ||
| public static final class Property { | ||
| private final Object id; | ||
| private final String scope; | ||
| private final PropertyKind kind; | ||
| private final String type; | ||
| private final String value; | ||
| private final String name; | ||
|
|
||
| public Property(Object id, String scope, String propertyName, PropertyKind kind, String type, String value) { | ||
| this.id = id; | ||
| this.scope = scope; | ||
| this.kind = kind; | ||
| this.type = type; | ||
| this.value = value; | ||
| this.name = propertyName; | ||
| } | ||
| public static final record Property(Object id, String scope, String name, PropertyKind kind, String type, String value) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: records are implicitly
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh. I left that change unintentionally there. I just needed a quick and good Well, if it made there let's keep that, I'll just remove the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its something we could also add as editor hint. I put it on my TODO list ;) |
||
|
|
||
| /** | ||
| * Returns the property id. The ID is a token that could be used to identify | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,6 @@ | |
| import java.io.PipedInputStream; | ||
| import java.io.PipedOutputStream; | ||
| import java.io.PrintWriter; | ||
| import java.io.Serializable; | ||
| import java.io.StringWriter; | ||
| import java.lang.reflect.Method; | ||
| import java.util.ArrayList; | ||
|
|
@@ -51,9 +50,7 @@ | |
| import java.util.regex.Pattern; | ||
| import java.util.stream.Collectors; | ||
| import javax.swing.SwingUtilities; | ||
| import org.gradle.tooling.BuildAction; | ||
| import org.gradle.tooling.BuildActionExecuter; | ||
| import org.gradle.tooling.BuildController; | ||
| import org.gradle.tooling.CancellationToken; | ||
| import org.gradle.tooling.CancellationTokenSource; | ||
| import org.gradle.tooling.GradleConnectionException; | ||
|
|
@@ -187,8 +184,7 @@ private static GradleProject loadGradleProject(ReloadContext ctx, CancellationTo | |
| for (String s : keys) { | ||
| Object o = info.getInfo().get(s); | ||
| // format just the 1st level: | ||
| if (o instanceof Collection) { | ||
| Collection c = (Collection)o; | ||
| if (o instanceof Collection c) { | ||
| if (!c.isEmpty()) { | ||
| LOG.finer(String.format(" %-20s: [", s)); | ||
| for (Object x: c) { | ||
|
|
@@ -200,8 +196,7 @@ private static GradleProject loadGradleProject(ReloadContext ctx, CancellationTo | |
| LOG.finer(" ]"); | ||
| continue; | ||
| } | ||
| } else if (o instanceof Map) { | ||
| Map m = (Map)o; | ||
| } else if (o instanceof Map m) { | ||
| if (!m.isEmpty()) { | ||
| LOG.finer(String.format(" %-20s: {", s)); | ||
| List<String> mkeys = new ArrayList<>(m.keySet()); | ||
|
|
@@ -273,15 +268,13 @@ private static GradleProject loadGradleProject(ReloadContext ctx, CancellationTo | |
| for (Report r : info.getReports()) { | ||
| reps.add(copyReport(r)); | ||
| } | ||
| Object o = new ArrayList<String>(reps.stream(). | ||
| var o = reps.stream(). | ||
| map((r) -> r.formatReportForHintOrProblem( | ||
| true, | ||
| FileUtil.toFileObject( | ||
| ctx.project.getGradleFiles().getBuildScript() | ||
| ) | ||
| )). | ||
| collect(Collectors.toList()) | ||
| ); | ||
| )).toList(); | ||
| LOG.log(Level.FINE, "Project {0} loaded with exception, and with problems: {1}", | ||
| new Object[] { | ||
| ctx.project, | ||
|
|
@@ -293,22 +286,20 @@ private static GradleProject loadGradleProject(ReloadContext ctx, CancellationTo | |
| for (String s : info.getProblems()) { | ||
| reps.add(GradleProject.createGradleReport(f == null ? null : f.toPath(), s)); | ||
| } | ||
| return ctx.previous.invalidate(reps.toArray(new GradleReport[0])); | ||
| return ctx.previous.invalidate(reps.toArray(GradleReport[]::new)); | ||
| } | ||
| } | ||
| } catch (GradleConnectionException | IllegalStateException ex) { | ||
| LOG.log(FINE, "Failed to retrieve project information for: " + base.getProjectDir(), ex); | ||
| List<GradleReport> problems = exceptionsToProblems(ctx.project.getGradleFiles().getBuildScript(), ex); | ||
| errors.openNotification(TIT_LOAD_FAILED(base.getProjectDir()), ex.getMessage(), GradleProjectErrorNotifications.bulletedList(problems)); | ||
| return ctx.previous.invalidate(problems.toArray(new GradleReport[0])); | ||
| } catch (ThreadDeath td) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd suggest to rethrow ThreadDeath here
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that cleanup of for-removal API is probably fine in this case. TD shouldn't occur anymore since most However, if this is a concern here, we could keep it in for one release more, since NB 30 will move the lower bound from 17 to JDK 21 at which point it truly can't be encountered anymore within NB. |
||
| throw td; | ||
| return ctx.previous.invalidate(problems.toArray(GradleReport[]::new)); | ||
| } catch (Throwable t) { | ||
| // catch any possible other errors, report project loading failure - but complete the loading operation. | ||
| LOG.log(Level.SEVERE, "Internal error during loading: " + base.getProjectDir(), t); | ||
| List<GradleReport> problems = exceptionsToProblems(ctx.project.getGradleFiles().getBuildScript(), t); | ||
| errors.openNotification(TIT_LOAD_FAILED(base.getProjectDir()), t.getMessage(), GradleProjectErrorNotifications.bulletedList(problems)); | ||
| return ctx.previous.invalidate(problems.toArray(new GradleReport[0])); | ||
| return ctx.previous.invalidate(problems.toArray(GradleReport[]::new)); | ||
| } finally { | ||
| loadedProjects.incrementAndGet(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possible refinement: it may be more stable to compare only problems that have error+exception severity.