From f36be2eb01bcbff01a513d64bff2d1aba54460b1 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 16 Jun 2009 03:04:46 +0200 Subject: Implemented a lot of stuff for javac, but we ran into 2 major issues still to be implemented: 1. The visit mode of a lombok handler (does not trigger off of annotations, instead sees every field, method, type, and statement), needs to be coded, 2. triggering off of annotations via APT's annotation handling system skips method-local classes. We'll need to recode this via an AST visitor like we need for issue #1 Other than that, triggering off of annotations works swimmingly! --- src/lombok/javac/handlers/PKG.java | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/lombok/javac/handlers/PKG.java (limited to 'src/lombok/javac/handlers/PKG.java') diff --git a/src/lombok/javac/handlers/PKG.java b/src/lombok/javac/handlers/PKG.java new file mode 100644 index 00000000..4622c3ee --- /dev/null +++ b/src/lombok/javac/handlers/PKG.java @@ -0,0 +1,34 @@ +package lombok.javac.handlers; + +import java.lang.reflect.Modifier; + +import javax.lang.model.element.Element; +import javax.lang.model.type.TypeKind; + +import lombok.AccessLevel; +import lombok.core.TransformationsUtil; + +class PKG { + static String toGetterName(Element field) { + CharSequence fieldName = field.getSimpleName(); + + boolean isBoolean = field.asType().getKind() == TypeKind.BOOLEAN; + + return TransformationsUtil.toGetterName(fieldName, isBoolean); + } + + static int toJavacModifier(AccessLevel accessLevel) { + switch ( accessLevel ) { + case MODULE: + case PACKAGE: + return 0; + default: + case PUBLIC: + return Modifier.PUBLIC; + case PRIVATE: + return Modifier.PRIVATE; + case PROTECTED: + return Modifier.PROTECTED; + } + } +} -- cgit