@Override public Set<ModifierKind> getModifiers() { CtVariable<?> v = getDeclaration(); if (v != null) { return v.getModifiers(); } // the modifiers of the "class" of AClass.class is the empty set if (this.isParentInitialized() && this.getParent() instanceof CtFieldAccess && ((CtFieldAccess) this.getParent()).getTarget() instanceof CtTypeAccess) { return emptySet(); } Member m = getActualField(); if (m != null) { return RtHelper.getModifiers(m.getModifiers()); } return Collections.emptySet(); }
private <T> void printCtFieldAccess(CtFieldAccess<T> f) { enterCtExpression(f); try (Writable _context = context.modify()) { if ((f.getVariable().isStatic() || "class".equals(f.getVariable().getSimpleName())) && f.getTarget() instanceof CtTypeAccess) { _context.ignoreGenerics(true); CtExpression<?> target = f.getTarget(); if (target != null) { boolean isInitializeStaticFinalField = isInitializeStaticFinalField(f.getTarget()); boolean isStaticField = f.getVariable().isStatic(); boolean isImportedField = this.isImported(f.getVariable());
CtExpression<?> target = fieldAccess.getTarget(); if (target instanceof CtNewArray<?>) { CtNewArray<?> newArr = (CtNewArray<?>) target;
CtExpression<?> access(CompilationNode target, AccessType accessType) { List<CtField<?>> accessPath = accessPath(target); CompilationNode thisNodeToAccess = this; while (!target.rootAccessPath.subList(0, min(thisNodeToAccess.rootAccessPath.size(), target.rootAccessPath.size())) .equals(thisNodeToAccess.rootAccessPath)) { thisNodeToAccess = thisNodeToAccess.parent; } CtFieldAccess<?> access = FieldAccessChains.chainToAccess(accessPath, accessType); CtClass<?> classToMerge = thisNodeToAccess.classesToMerge.get(0); CtThisAccess<?> thisAccess = f.Code().createThisAccess(classToMerge.getReference()); // thisAccess.setImplicit(false); if (access != null) { CtFieldAccess<?> innerMostAccess = access; while (innerMostAccess.getTarget() != null) { innerMostAccess = (CtFieldAccess<?>) innerMostAccess.getTarget(); } innerMostAccess.setTarget(thisAccess); return access; } else { return thisAccess; } }
@Override public <T> void visitCtFieldAccess(CtFieldAccess<T> f) { enterCtExpression(f); if (f.getTarget() != null) { scan(f.getTarget()); write("."); context.ignoreStaticAccess = true; } context.ignoreGenerics = true; scan(f.getVariable()); context.ignoreGenerics = false; context.ignoreStaticAccess = false; exitCtExpression(f); }
private boolean checkAccessedViaStageRefs(CtExpression<?> target) { if (target == null || target instanceof CtThisAccess) return true; if (target instanceof CtFieldAccess) { CtFieldAccess fieldAccess = (CtFieldAccess) target; CtField field = fieldAccess.getVariable().getDeclaration(); if (field != null && field.getAnnotation(StageRef.class) != null) { return checkAccessedViaStageRefs(fieldAccess.getTarget()); } } return false; }
private void guardFieldsAccess() { cxt.allNodes().forEach(node -> { List<CtFieldAccess<?>> fieldAccesses = node.filterBlocksForBuildingDeps((CtFieldAccess<?> fa) -> true); fieldAccesses.forEach((CtFieldAccess fa) -> { CtField<?> field = fa.getVariable().getDeclaration(); if (field != null) { StageModel stage = cxt.getStageModel(field); if (stage != null && stage != node) { CtExpression<?> target = fa.getTarget(); CtTargetedExpression<?, CtExpression<?>> access = stage.fieldAccess(target, field); if (target != null) target.setParent(access); fa.replace(access); } } }); }); }
@Override public <T> void visitCtFieldAccess(CtFieldAccess<T> f) { enter(f); scan(f.getVariable()); // scan(fieldAccess.getType()); scan(f.getAnnotations()); scanReferences(f.getTypeCasts()); scan(f.getVariable()); scan(f.getTarget()); exit(f); }
@Override public <T> void visitCtFieldAccess(CtFieldAccess<T> f) { enter(f); scan(f.getAnnotations()); scan(f.getType()); scanReferences(f.getTypeCasts()); scan(f.getTarget()); scan(f.getVariable()); exit(f); }
@Override public <T> void visitCtFieldAccess(CtFieldAccess<T> f) { enter(f); scan(f.getVariable()); // scan(fieldAccess.getType()); scan(f.getAnnotations()); scanReferences(f.getTypeCasts()); scan(f.getVariable()); scan(f.getTarget()); exit(f); }
CtFieldReference<?> ref = fieldAccess.getVariable(); if ("length".equals(ref.getSimpleName())) { if (fieldAccess.getTarget() instanceof CtFieldAccess) { ref = ((CtFieldAccess<?>) fieldAccess.getTarget()).getVariable(); if (Parameters.isParameterSource(ref)) { Object[] value = (Object[]) Parameters.getValue(template, ref.getSimpleName(), null);
fa = (CtFieldAccess<?>) ((CtArrayAccess<?, CtExpression<?>>) invocation.getTarget()).getTarget(); if ((fa != null) && (fa.getTarget() == null)) { TemplateParameter<?> tparamValue = (TemplateParameter<?>) Parameters .getValue(template, fa.getVariable().getSimpleName(), Parameters.getIndex(fa));