mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 00:16:47 +00:00
Merge branch 'projectlombok:master' into jacksonizedAccessors
This commit is contained in:
9 files changed
+64
-42
No files matched your search
@@ -1,10 +1,11 @@
|
||||
Lombok Changelog
|
||||
----------------
|
||||
|
||||
### v1.18.37 "Edgy Guinea Pig"
|
||||
### v1.18.38 (March 31st, 2025)
|
||||
* PLATFORM: JDK24 support added.
|
||||
* FEATURE: Lombok's nullity annotation now supports [JSpecify](https://jspecify.dev) out of the box, using [config key](https://projectlombok.org/features/configuration) `jspecify`.
|
||||
* BUGFIX: Recent eclipse releases would get you 'negative length' error. The bug had always been in lombok but didn't matter until recent releases. [Issue #3823](https://github.com/projectlombok/lombok/issues/3823).
|
||||
* BUGFIX: The 'extract local variable' refactor script of VSCode wouldn't replace all occurrences if run on a method call to a lombok generated method. [Issue #3783](https://github.com/projectlombok/lombok/issues/3783).
|
||||
|
||||
### v1.18.36 (November 15th, 2024)
|
||||
* PLATFORM: JDK23 support added.
|
||||
|
||||
@@ -30,9 +30,9 @@ public class Version {
|
||||
// ** CAREFUL ** - this class must always compile with 0 dependencies (it must not refer to any other sources or libraries).
|
||||
// Note: In 'X.Y.Z', if Z is odd, its a snapshot build built from the repository, so many different 0.10.3 versions can exist, for example.
|
||||
// Official builds always end in an even number. (Since 0.10.2).
|
||||
private static final String VERSION = "1.18.37";
|
||||
private static final String RELEASE_NAME = "Edgy Guinea Pig";
|
||||
// private static final String RELEASE_NAME = "Envious Ferret";
|
||||
private static final String VERSION = "1.18.38";
|
||||
// private static final String RELEASE_NAME = "Edgy Guinea Pig";
|
||||
private static final String RELEASE_NAME = "Envious Ferret";
|
||||
|
||||
// Named version history:
|
||||
// Angry Butterfly
|
||||
|
||||
@@ -31,11 +31,13 @@ import java.util.regex.Pattern;
|
||||
|
||||
import com.sun.tools.javac.parser.Tokens.Comment;
|
||||
import com.sun.tools.javac.tree.DocCommentTable;
|
||||
import com.sun.tools.javac.tree.EndPosTable;
|
||||
import com.sun.tools.javac.tree.JCTree;
|
||||
import com.sun.tools.javac.tree.JCTree.JCClassDecl;
|
||||
import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
|
||||
import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
|
||||
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
|
||||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
||||
import com.sun.tools.javac.tree.TreeScanner;
|
||||
|
||||
import lombok.javac.CommentInfo;
|
||||
@@ -132,6 +134,35 @@ public class DocCommentIntegrator {
|
||||
return docCommentContent_;
|
||||
}
|
||||
|
||||
@Override public DiagnosticPosition getPos() {
|
||||
return new DiagnosticPosition() {
|
||||
public JCTree getTree() {
|
||||
return node;
|
||||
}
|
||||
|
||||
public int getStartPosition() {
|
||||
return pos;
|
||||
}
|
||||
|
||||
public int getPreferredPosition() {
|
||||
return pos;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused") // We compile against very old versions of javac intentionally (to support old stuff), but this is the method for newer impls.
|
||||
public int getEndPosition(EndPosTable endPosTable) {
|
||||
int end = endPosTable == null ? 0 : endPosTable.getEndPos(node);
|
||||
if (end > pos) return end;
|
||||
return pos + docCommentContent_.length();
|
||||
}
|
||||
|
||||
public int getEndPosition(Map<JCTree, Integer> endPosTable) {
|
||||
Integer end = endPosTable.get(node);
|
||||
if (end != null && end.intValue() > pos) return end.intValue();
|
||||
return pos + docCommentContent_.length();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override public int getSourcePos(int index) {
|
||||
return pos + index;
|
||||
}
|
||||
|
||||
@@ -1599,39 +1599,17 @@ public class PrettyPrinter extends JCTree.Visitor {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Method getExtendsClause, getEndPosition, storeEnd;
|
||||
private static final Method getExtendsClause, getEndPosition;
|
||||
|
||||
static {
|
||||
getExtendsClause = getMethod(JCClassDecl.class, "getExtendsClause", new Class<?>[0]);
|
||||
|
||||
if (getJavaCompilerVersion() < 8) {
|
||||
getEndPosition = getMethod(DiagnosticPosition.class, "getEndPosition", java.util.Map.class);
|
||||
storeEnd = getMethod(java.util.Map.class, "put", Object.class, Object.class);
|
||||
} else {
|
||||
getEndPosition = getMethod(DiagnosticPosition.class, "getEndPosition", "com.sun.tools.javac.tree.EndPosTable");
|
||||
Method storeEndMethodTemp;
|
||||
Class<?> endPosTable;
|
||||
try {
|
||||
endPosTable = Class.forName("com.sun.tools.javac.tree.EndPosTable");
|
||||
} catch (ClassNotFoundException ex) {
|
||||
throw sneakyThrow(ex);
|
||||
}
|
||||
try {
|
||||
storeEndMethodTemp = Permit.getMethod(endPosTable, "storeEnd", JCTree.class, int.class);
|
||||
} catch (NoSuchMethodException e) {
|
||||
try {
|
||||
endPosTable = Class.forName("com.sun.tools.javac.parser.JavacParser$AbstractEndPosTable");
|
||||
storeEndMethodTemp = Permit.getMethod(endPosTable, "storeEnd", JCTree.class, int.class);
|
||||
} catch (NoSuchMethodException ex) {
|
||||
throw sneakyThrow(ex);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
throw sneakyThrow(ex);
|
||||
}
|
||||
}
|
||||
storeEnd = storeEndMethodTemp;
|
||||
}
|
||||
Permit.setAccessible(getEndPosition);
|
||||
Permit.setAccessible(storeEnd);
|
||||
}
|
||||
|
||||
private static Method getMethod(Class<?> clazz, String name, Class<?>... paramTypes) {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.sun.tools.javac.tree;
|
||||
|
||||
public interface EndPosTable {
|
||||
int getEndPos(JCTree tree);
|
||||
}
|
||||
File renamed without changes.
@@ -55,7 +55,6 @@ import com.sun.tools.javac.tree.JCTree.JCIdent;
|
||||
import com.sun.tools.javac.tree.JCTree.JCImport;
|
||||
import com.sun.tools.javac.tree.JCTree.JCLiteral;
|
||||
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
|
||||
import com.sun.tools.javac.tree.TreeInfo;
|
||||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
||||
|
||||
import lombok.core.ClassLiteral;
|
||||
|
||||
@@ -9,14 +9,19 @@
|
||||
${changelogEdge?no_esc}
|
||||
</div><div class="row text-center">
|
||||
<h2><a href="/lombok-edge.jar" id="downloadLink">Download edge release now!</a></h2>
|
||||
<p>
|
||||
<p class="text-left">
|
||||
You can use the edge release from maven using the projectlombok.org repository.
|
||||
This requires:<ul>
|
||||
This requires:
|
||||
</p>
|
||||
<ul class="text-left">
|
||||
<li>Adding the lombok maven repository to your <code>repositories</code> section</li>
|
||||
<li>Adding lombok as a dependency to your project in the <code>dependencies</code> section, specifying version <code>edge-SNAPSHOT</code>.</li>
|
||||
<li>Adding lombok as an annotation processor in the <code>annotationProcessorPaths</code> section, specifying version <code>edge-SNAPSHOT</code>.</li>
|
||||
</ul>
|
||||
These sections in your pom file should look like this:<pre>
|
||||
</ul>
|
||||
<p>
|
||||
These sections in your pom file should look like this:
|
||||
</p>
|
||||
<pre>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>projectlombok.org</id>
|
||||
@@ -49,12 +54,12 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</pre>
|
||||
</p>
|
||||
</build></pre>
|
||||
|
||||
<p>
|
||||
You can use the edge release from gradle using the projectlombok.org repository:<pre>
|
||||
You can use the edge release from gradle using the projectlombok.org repository:
|
||||
</p>
|
||||
<pre>
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://projectlombok.org/edge-releases' }
|
||||
@@ -69,11 +74,10 @@ dependencies {
|
||||
|
||||
apt 'org.projectlombok:lombok:edge-SNAPSHOT'
|
||||
}</pre>
|
||||
</p>
|
||||
</div><div class="row text-center">
|
||||
<p>
|
||||
Cutting edge a bit too gutsy for you? You can grab the <a href="download.html">stable release</a> instead.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</@main.scaffold>
|
||||
</@main.scaffold>
|
||||
@@ -11,7 +11,9 @@
|
||||
|
||||
<@s.section title="Adding lombok to your pom file">
|
||||
<p>
|
||||
To include lombok as a 'provided' dependency, add it to your <code><dependencies></code> block like so:<pre>
|
||||
To include lombok as a 'provided' dependency, add it to your <code><dependencies></code> block like so:
|
||||
</p>
|
||||
<pre>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
@@ -21,9 +23,10 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</pre>
|
||||
</p>
|
||||
<p>
|
||||
You also need to add lombok as an annotation processor. This is mandatory starting with JDK23, or JDK9+ if compiling as modules (you have <code>module-info.java</code> files in your build):<pre>
|
||||
You also need to add lombok as an annotation processor. This is mandatory starting with JDK23, or JDK9+ if compiling as modules (you have <code>module-info.java</code> files in your build):
|
||||
</p>
|
||||
<pre>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@@ -41,6 +44,7 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</pre>
|
||||
</@s.section>
|
||||
|
||||
<@s.section title="Eclipse Compiler (ECJ/JDT)">
|
||||
|
||||
Reference in new issue
Block a user