public GwtRetention getRetention(JConstructor ctor) { GwtRetention retention = ctor.getAnnotation(GwtRetention.class); if (retention == null) { retention = strategy.constructorRetention(); } return retention; }
private static void extractConstructors(TreeLogger logger, KeepConstructor keepCtor, JClassType injectionType, ReflectionManifest manifest) { boolean keepCtors = keepCtor != null; boolean keepAnnos = manifest.anno != null; Set<String> seen = new HashSet<String>(); Set<? extends JClassType> allTypes = injectionType.getFlattenedSupertypeHierarchy(); for(JClassType nextClass : allTypes) { for (JConstructor ctor : nextClass.getConstructors()) { if (keepCtors || ctor.getAnnotation(KeepConstructor.class) != null){ // do not include overridden constructors if (seen.add(ctor.getJsniSignature())) { final Annotation[] annos; if (keepAnnos || ctor.getAnnotation(KeepAnnotation.class) != null) { annos = ctor.getAnnotations(); } else { // only keep annotations annotated with KeepAnnotation. final List<Annotation> keepers = new ArrayList<Annotation>(); for (Annotation anno : ctor.getAnnotations()) { if (anno.annotationType().getAnnotation(KeepAnnotation.class) != null) keepers.add(anno); } annos = keepers.toArray(new Annotation[keepers.size()]); } manifest.constructors.put(ctor, annos); } } } nextClass = nextClass.getSuperclass(); } }
public GwtRetention getRetention(final JConstructor ctor) { GwtRetention retention = ctor.getAnnotation(GwtRetention.class); if (retention == null) { if (strategy.memberRetention().length == 0) { retention = strategy.constructorRetention(); } else { retention = strategy.memberRetention()[0]; } } return retention; }
/** * Finds the constructor annotated with @UiConcontructor if there is one, and * puts it in the {@link #uiConstructor} field. * * @param fieldType the type of the field */ private void findUiConstructor(JClassType fieldType) throws UnableToCompleteException { for (JConstructor ctor : fieldType.getConstructors()) { if (ctor.getAnnotation(UiConstructor.class) != null) { if (uiConstructor != null) { logger.die(fieldType.getName() + " has more than one constructor annotated with @UiConstructor"); } uiConstructor = ctor; } } }
/** * Finds the constructor annotated with @UiConcontructor if there is one, and * puts it in the {@link #uiConstructor} field. * * @param fieldType the type of the field */ private void findUiConstructor(JClassType fieldType) throws UnableToCompleteException { for (JConstructor ctor : fieldType.getConstructors()) { if (ctor.getAnnotation(UiConstructor.class) != null) { if (uiConstructor != null) { logger.die(fieldType.getName() + " has more than one constructor annotated with @UiConstructor"); } uiConstructor = ctor; } } }
GwtRetention retention = ctor.getAnnotation(GwtRetention.class); if (retention == null) retention = strategy.fieldRetention();
GwtRetention retention = ctor.getAnnotation(GwtRetention.class); if (retention == null) { retention = strategy.fieldRetention();