mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 00:16:47 +00:00
trivial: javadoc fixes, renamed 'className' to 'fileName'for postprocessor
This commit is contained in:
1 parent
bcdd5226ce
commit
c10b91309e
6 files changed
+15
-15
No files matched your search
@@ -39,7 +39,7 @@ public class Lombok {
|
||||
* about the concept of a 'checked exception'. All this method does is hide the act of throwing a checked exception
|
||||
* from the java compiler.
|
||||
* <p>
|
||||
* Note that this method has a return type of {@code RuntimeException} it is advised you always call this
|
||||
* Note that this method has a return type of {@code RuntimeException}; it is advised you always call this
|
||||
* method as argument to the {@code throw} statement to avoid compiler errors regarding no return
|
||||
* statement and similar problems. This method won't of course return an actual {@code RuntimeException} -
|
||||
* it never returns, it always throws the provided exception.
|
||||
|
||||
@@ -32,17 +32,17 @@ public final class PostCompiler {
|
||||
|
||||
private static List<PostCompilerTransformation> transformations;
|
||||
|
||||
public static byte[] applyTransformations(byte[] original, String className, DiagnosticsReceiver diagnostics) {
|
||||
public static byte[] applyTransformations(byte[] original, String fileName, DiagnosticsReceiver diagnostics) {
|
||||
init(diagnostics);
|
||||
byte[] previous = original;
|
||||
for (PostCompilerTransformation transformation : transformations) {
|
||||
try {
|
||||
byte[] next = transformation.applyTransformations(previous, className, diagnostics);
|
||||
byte[] next = transformation.applyTransformations(previous, fileName, diagnostics);
|
||||
if (next != null) {
|
||||
previous = next;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
diagnostics.addWarning(String.format("Error during the transformation of '%s'; post-compiler '%s' caused an exception: %s", className, transformation.getClass().getName(), e.getMessage()));
|
||||
diagnostics.addWarning(String.format("Error during the transformation of '%s'; post-compiler '%s' caused an exception: %s", fileName, transformation.getClass().getName(), e.getMessage()));
|
||||
}
|
||||
}
|
||||
return previous;
|
||||
@@ -58,16 +58,16 @@ public final class PostCompiler {
|
||||
}
|
||||
}
|
||||
|
||||
public static OutputStream wrapOutputStream(final OutputStream originalStream, final String className, final DiagnosticsReceiver diagnostics) throws IOException {
|
||||
public static OutputStream wrapOutputStream(final OutputStream originalStream, final String fileName, final DiagnosticsReceiver diagnostics) throws IOException {
|
||||
return new ByteArrayOutputStream() {
|
||||
@Override public void close() throws IOException {
|
||||
// no need to call super
|
||||
byte[] original = toByteArray();
|
||||
byte[] copy = null;
|
||||
try {
|
||||
copy = applyTransformations(original, className, diagnostics);
|
||||
copy = applyTransformations(original, fileName, diagnostics);
|
||||
} catch (Exception e) {
|
||||
diagnostics.addWarning(String.format("Error during the transformation of '%s'; no post-compilation has been applied", className));
|
||||
diagnostics.addWarning(String.format("Error during the transformation of '%s'; no post-compilation has been applied", fileName));
|
||||
}
|
||||
|
||||
if (copy == null) {
|
||||
|
||||
@@ -22,5 +22,5 @@
|
||||
package lombok.core;
|
||||
|
||||
public interface PostCompilerTransformation {
|
||||
byte[] applyTransformations(byte[] original, String className, DiagnosticsReceiver diagnostics);
|
||||
byte[] applyTransformations(byte[] original, String fileName, DiagnosticsReceiver diagnostics);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public class TransformationsUtil {
|
||||
//could also be 'foo'.
|
||||
baseNames.add(fieldName.toString().substring(knownBooleanPrefix.length()));
|
||||
//prefix with 'is' but instead just use the field name as is. The isLowerCase check is so we don't turn
|
||||
//hashCodeGenerated, which so happens to start with 'has', into hasHCodeGenerated instead of isHashCodeGenerated.
|
||||
//hashCodeGenerated, which so happens to start with 'has', into hashCodeGenerated instead of isHashCodeGenerated.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,17 +37,17 @@ import lombok.core.PostCompiler;
|
||||
|
||||
final class InterceptingJavaFileObject implements JavaFileObject {
|
||||
private final JavaFileObject delegate;
|
||||
private final String className;
|
||||
private final String fileName;
|
||||
private final DiagnosticsReceiver diagnostics;
|
||||
|
||||
public InterceptingJavaFileObject(JavaFileObject original, String className, DiagnosticsReceiver diagnostics) {
|
||||
public InterceptingJavaFileObject(JavaFileObject original, String fileName, DiagnosticsReceiver diagnostics) {
|
||||
this.delegate = original;
|
||||
this.className = className;
|
||||
this.fileName = fileName;
|
||||
this.diagnostics = diagnostics;
|
||||
}
|
||||
|
||||
public OutputStream openOutputStream() throws IOException {
|
||||
return PostCompiler.wrapOutputStream(delegate.openOutputStream(), className, diagnostics);
|
||||
return PostCompiler.wrapOutputStream(delegate.openOutputStream(), fileName, diagnostics);
|
||||
}
|
||||
|
||||
public Writer openWriter() throws IOException {
|
||||
|
||||
@@ -114,8 +114,8 @@ public class PatchFixes {
|
||||
return newSimpleNames;
|
||||
}
|
||||
|
||||
public static byte[] runPostCompiler(byte[] bytes, String className) {
|
||||
byte[] transformed = PostCompiler.applyTransformations(bytes, className, DiagnosticsReceiver.CONSOLE);
|
||||
public static byte[] runPostCompiler(byte[] bytes, String fileName) {
|
||||
byte[] transformed = PostCompiler.applyTransformations(bytes, fileName, DiagnosticsReceiver.CONSOLE);
|
||||
return transformed == null ? bytes : transformed;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user