mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 06:17:44 +00:00
Merge branch 'master' of git@github.com:rzwitserloot/lombok
This commit is contained in:
commit
bd3966af0e
13 files changed
+121
-58
No files matched your search
@@ -1,4 +1,4 @@
|
||||
#Fri Jun 12 03:57:29 CEST 2009
|
||||
#Sun Oct 18 14:45:17 CEST 2009
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
@@ -7,7 +7,69 @@ org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.processAnnotations=enabled
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
+6
-6
@@ -45,10 +45,10 @@ import com.sun.tools.javac.processing.JavacProcessingEnvironment;
|
||||
@SupportedSourceVersion(SourceVersion.RELEASE_6)
|
||||
public class DisableCheckedExceptionsAgent extends AbstractProcessor {
|
||||
/** Inject an agent if we're on a sun-esque JVM. */
|
||||
@Override public void init(ProcessingEnvironment processingEnv) {
|
||||
super.init(processingEnv);
|
||||
if (!(processingEnv instanceof JavacProcessingEnvironment)) {
|
||||
processingEnv.getMessager().printMessage(Kind.WARNING, "You aren't using a compiler based around javac v1.6, so lombok will not work properly.");
|
||||
@Override public void init(ProcessingEnvironment procEnv) {
|
||||
super.init(procEnv);
|
||||
if (!(procEnv instanceof JavacProcessingEnvironment)) {
|
||||
procEnv.getMessager().printMessage(Kind.WARNING, "You aren't using a compiler based around javac v1.6, so lombok will not work properly.");
|
||||
this.processingEnv = null;
|
||||
}
|
||||
|
||||
@@ -60,11 +60,11 @@ public class DisableCheckedExceptionsAgent extends AbstractProcessor {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void agentmain(String agentArgs, Instrumentation instrumentation) throws Exception {
|
||||
public static void agentmain(@SuppressWarnings("unused") String agentArgs, Instrumentation instrumentation) throws Exception {
|
||||
registerPatchScripts(instrumentation, true);
|
||||
}
|
||||
|
||||
public static void premain(String agentArgs, Instrumentation instrumentation) throws Exception {
|
||||
public static void premain(@SuppressWarnings("unused") String agentArgs, Instrumentation instrumentation) throws Exception {
|
||||
registerPatchScripts(instrumentation, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -210,9 +210,8 @@ public abstract class AST<A extends AST<A, L, N>, L extends LombokNode<A, L, N>,
|
||||
if (type instanceof ParameterizedType) {
|
||||
Type component = ((ParameterizedType)type).getActualTypeArguments()[0];
|
||||
return component instanceof Class<?> ? (Class<?>)component : Object.class;
|
||||
} else {
|
||||
return Object.class;
|
||||
}
|
||||
return Object.class;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -202,18 +202,19 @@ public class AnnotationValues<A extends Annotation> {
|
||||
Object defaultValue = method.getDefaultValue();
|
||||
if (defaultValue == null) throw makeNoDefaultFail(v, method);
|
||||
return defaultValue;
|
||||
} else return result;
|
||||
} else {
|
||||
if (result == null) {
|
||||
if (v.valueGuesses.size() == 1) {
|
||||
Object defaultValue = method.getDefaultValue();
|
||||
if (defaultValue == null) throw makeNoDefaultFail(v, method);
|
||||
return defaultValue;
|
||||
} else throw new AnnotationValueDecodeFail(v,
|
||||
"I can't make sense of this annotation value. Try using a fully qualified literal.", idx);
|
||||
}
|
||||
Array.set(array, idx++, result);
|
||||
return result;
|
||||
}
|
||||
if (result == null) {
|
||||
if (v.valueGuesses.size() == 1) {
|
||||
Object defaultValue = method.getDefaultValue();
|
||||
if (defaultValue == null) throw makeNoDefaultFail(v, method);
|
||||
return defaultValue;
|
||||
}
|
||||
throw new AnnotationValueDecodeFail(v,
|
||||
"I can't make sense of this annotation value. Try using a fully qualified literal.", idx);
|
||||
}
|
||||
Array.set(array, idx++, result);
|
||||
}
|
||||
|
||||
return array;
|
||||
|
||||
@@ -125,8 +125,8 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A,
|
||||
* Also affects the underlying (Eclipse/javac) AST.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public L replaceWith(N newN, Kind kind) {
|
||||
L newNode = ast.buildTree(newN, kind);
|
||||
public L replaceWith(N newN, Kind newNodeKind) {
|
||||
L newNode = ast.buildTree(newN, newNodeKind);
|
||||
newNode.parent = parent;
|
||||
for (int i = 0; i < parent.children.size(); i++) {
|
||||
if (parent.children.get(i) == this) ((List)parent.children).set(i, newNode);
|
||||
@@ -227,8 +227,8 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A,
|
||||
* Does not change the underlying (javac/Eclipse) AST, only the wrapped view.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public L add(N newChild, Kind kind) {
|
||||
L n = ast.buildTree(newChild, kind);
|
||||
public L add(N newChild, Kind newChildKind) {
|
||||
L n = ast.buildTree(newChild, newChildKind);
|
||||
if (n == null) return null;
|
||||
n.parent = (L) this;
|
||||
((List)children).add(n);
|
||||
|
||||
@@ -123,7 +123,7 @@ public class SpiLoadUtil {
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
in.close();
|
||||
if (in != null) in.close();
|
||||
} catch (Throwable ignore) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public interface EclipseASTVisitor {
|
||||
|
||||
private String str(char[] c) {
|
||||
if (c == null) return "(NULL)";
|
||||
else return new String(c);
|
||||
return new String(c);
|
||||
}
|
||||
|
||||
private String str(TypeReference type) {
|
||||
|
||||
@@ -162,6 +162,8 @@ class PKG {
|
||||
node = node.up();
|
||||
}
|
||||
|
||||
if (node == null) return null;
|
||||
|
||||
if (node.get() instanceof TypeDeclaration) {
|
||||
for (AbstractMethodDeclaration def : ((TypeDeclaration)node.get()).methods) {
|
||||
if (def instanceof ConstructorDeclaration) {
|
||||
@@ -180,6 +182,8 @@ class PKG {
|
||||
node = node.up();
|
||||
}
|
||||
|
||||
if (node == null) return null;
|
||||
|
||||
if (node.get() instanceof TypeDeclaration) {
|
||||
for (AbstractMethodDeclaration def : ((TypeDeclaration)node.get()).methods) {
|
||||
char[] mName = def.selector;
|
||||
|
||||
@@ -40,7 +40,6 @@ import java.awt.event.ActionListener;
|
||||
import java.awt.font.TextAttribute;
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -276,7 +275,7 @@ public class Installer {
|
||||
return container;
|
||||
}
|
||||
|
||||
private Component buildEclipseArea() throws IOException {
|
||||
private Component buildEclipseArea() {
|
||||
JPanel container = new JPanel();
|
||||
|
||||
container.setLayout(new GridBagLayout());
|
||||
@@ -357,17 +356,16 @@ public class Installer {
|
||||
buttonBar.add(specifyEclipseLocationButton);
|
||||
specifyEclipseLocationButton.addActionListener(new ActionListener() {
|
||||
@Override public void actionPerformed(ActionEvent event) {
|
||||
final String name = EclipseFinder.getEclipseExecutableName();
|
||||
final String exeName = EclipseFinder.getEclipseExecutableName();
|
||||
String file = null;
|
||||
|
||||
if (EclipseFinder.getOS() == OS.MAC_OS_X) {
|
||||
FileDialog chooser = new FileDialog(appWindow);
|
||||
chooser.setMode(FileDialog.LOAD);
|
||||
chooser.setFilenameFilter(new FilenameFilter() {
|
||||
@Override public boolean accept(File dir, String name) {
|
||||
if (name.equalsIgnoreCase(name)) return true;
|
||||
if (new File(dir, name).isDirectory()) return true;
|
||||
|
||||
@Override public boolean accept(File dir, String fileName) {
|
||||
if (exeName.equalsIgnoreCase(fileName)) return true;
|
||||
if (new File(dir, fileName).isDirectory()) return true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@@ -381,7 +379,7 @@ public class Installer {
|
||||
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
||||
chooser.setFileFilter(new FileFilter() {
|
||||
@Override public boolean accept(File f) {
|
||||
if (f.getName().equalsIgnoreCase(name)) return true;
|
||||
if (f.getName().equalsIgnoreCase(exeName)) return true;
|
||||
if (f.isDirectory()) return true;
|
||||
|
||||
return false;
|
||||
@@ -668,7 +666,7 @@ public class Installer {
|
||||
@Override public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void buildChrome(Container appWindowContainer) {
|
||||
JLabel leftGraphic = new JLabel(new ImageIcon(Installer.class.getResource("/lombok/installer/lombok.png")));
|
||||
|
||||
@@ -251,6 +251,7 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> {
|
||||
}
|
||||
|
||||
/** For javac, both JCExpression and JCStatement are considered as valid children types. */
|
||||
@Override
|
||||
protected Collection<Class<? extends JCTree>> getStatementTypes() {
|
||||
Collection<Class<? extends JCTree>> collection = new ArrayList<Class<? extends JCTree>>(2);
|
||||
collection.add(JCStatement.class);
|
||||
@@ -305,11 +306,9 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> {
|
||||
com.sun.tools.javac.util.List<?> oldL = (com.sun.tools.javac.util.List<?>) current;
|
||||
com.sun.tools.javac.util.List<?> newL = replaceInConsList(oldL, oldO, newO);
|
||||
if (chain.isEmpty()) return newL;
|
||||
else {
|
||||
List<Collection<?>> reducedChain = new ArrayList<Collection<?>>(chain);
|
||||
Collection<?> newCurrent = reducedChain.remove(reducedChain.size() -1);
|
||||
return setElementInConsList(reducedChain, newCurrent, oldL, newL);
|
||||
}
|
||||
List<Collection<?>> reducedChain = new ArrayList<Collection<?>>(chain);
|
||||
Collection<?> newCurrent = reducedChain.remove(reducedChain.size() -1);
|
||||
return setElementInConsList(reducedChain, newCurrent, oldL, newL);
|
||||
}
|
||||
|
||||
private com.sun.tools.javac.util.List<?> replaceInConsList(com.sun.tools.javac.util.List<?> oldL, Object oldO, Object newO) {
|
||||
@@ -323,16 +322,16 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> {
|
||||
}
|
||||
|
||||
if (repl) return com.sun.tools.javac.util.List.<Object>from(a);
|
||||
else return oldL;
|
||||
return oldL;
|
||||
}
|
||||
|
||||
private void increaseErrorCount(Messager messager) {
|
||||
private void increaseErrorCount(Messager m) {
|
||||
try {
|
||||
Field f = messager.getClass().getDeclaredField("errorCount");
|
||||
Field f = m.getClass().getDeclaredField("errorCount");
|
||||
f.setAccessible(true);
|
||||
if (f.getType() == int.class) {
|
||||
int val = ((Number)f.get(messager)).intValue();
|
||||
f.set(messager, val +1);
|
||||
int val = ((Number)f.get(m)).intValue();
|
||||
f.set(m, val +1);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
//Very unfortunate, but in most cases it still works fine, so we'll silently swallow it.
|
||||
|
||||
@@ -81,10 +81,10 @@ public class JavacNode extends lombok.core.LombokNode<JavacAST, JavacNode, JCTre
|
||||
visitor.endVisitInitializer(this, (JCBlock)get());
|
||||
break;
|
||||
case ARGUMENT:
|
||||
JCMethodDecl parent = (JCMethodDecl) up().get();
|
||||
visitor.visitMethodArgument(this, (JCVariableDecl)get(), parent);
|
||||
JCMethodDecl parentMethod = (JCMethodDecl) up().get();
|
||||
visitor.visitMethodArgument(this, (JCVariableDecl)get(), parentMethod);
|
||||
ast.traverseChildren(visitor, this);
|
||||
visitor.endVisitMethodArgument(this, (JCVariableDecl)get(), parent);
|
||||
visitor.endVisitMethodArgument(this, (JCVariableDecl)get(), parentMethod);
|
||||
break;
|
||||
case LOCAL:
|
||||
visitor.visitLocal(this, (JCVariableDecl)get());
|
||||
@@ -175,7 +175,7 @@ public class JavacNode extends lombok.core.LombokNode<JavacAST, JavacNode, JCTre
|
||||
/**
|
||||
* Generates an compiler error focused on the AST node represented by this node object.
|
||||
*/
|
||||
public void addError(String message) {
|
||||
@Override public void addError(String message) {
|
||||
ast.printMessage(Diagnostic.Kind.ERROR, message, this, null);
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ public class JavacNode extends lombok.core.LombokNode<JavacAST, JavacNode, JCTre
|
||||
/**
|
||||
* Generates a compiler warning focused on the AST node represented by this node object.
|
||||
*/
|
||||
public void addWarning(String message) {
|
||||
@Override public void addWarning(String message) {
|
||||
ast.printMessage(Diagnostic.Kind.WARNING, message, this, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,15 +69,15 @@ public class Processor extends AbstractProcessor {
|
||||
private Trees trees;
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override public void init(ProcessingEnvironment processingEnv) {
|
||||
super.init(processingEnv);
|
||||
if (!(processingEnv instanceof JavacProcessingEnvironment)) {
|
||||
processingEnv.getMessager().printMessage(Kind.WARNING, "You aren't using a compiler based around javac v1.6, so lombok will not work properly.");
|
||||
@Override public void init(ProcessingEnvironment procEnv) {
|
||||
super.init(procEnv);
|
||||
if (!(procEnv instanceof JavacProcessingEnvironment)) {
|
||||
procEnv.getMessager().printMessage(Kind.WARNING, "You aren't using a compiler based around javac v1.6, so lombok will not work properly.");
|
||||
this.processingEnv = null;
|
||||
} else {
|
||||
this.processingEnv = (JavacProcessingEnvironment) processingEnv;
|
||||
handlers = HandlerLibrary.load(processingEnv.getMessager());
|
||||
trees = Trees.instance(processingEnv);
|
||||
this.processingEnv = (JavacProcessingEnvironment) procEnv;
|
||||
handlers = HandlerLibrary.load(procEnv.getMessager());
|
||||
trees = Trees.instance(procEnv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,11 +44,11 @@ import lombok.patcher.scripts.ScriptBuilder;
|
||||
public class EclipsePatcher {
|
||||
private EclipsePatcher() {}
|
||||
|
||||
public static void agentmain(String agentArgs, Instrumentation instrumentation) throws Exception {
|
||||
public static void agentmain(@SuppressWarnings("unused") String agentArgs, Instrumentation instrumentation) throws Exception {
|
||||
registerPatchScripts(instrumentation, true);
|
||||
}
|
||||
|
||||
public static void premain(String agentArgs, Instrumentation instrumentation) throws Exception {
|
||||
public static void premain(@SuppressWarnings("unused") String agentArgs, Instrumentation instrumentation) throws Exception {
|
||||
registerPatchScripts(instrumentation, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user