private void adjustTestClass(ADefaultClassDeclIR copy) { for(AMethodDeclIR m : copy.getMethods()) { m.setStatic(false); } for(int i = 0; i < copy.getMethods().size(); i++) { AMethodDeclIR m = copy.getMethods().get(i); if(m.getIsConstructor()) { copy.getMethods().remove(i); break; } } }
public void removeRunFullSuiteMethod(ADefaultClassDeclIR node) { for (int i = 0; i < node.getMethods().size(); i++) { AMethodDeclIR currentMethod = node.getMethods().get(i); if (currentMethod.getName().equals(IRConstants.TEST_CASE_RUN_FULL_SUITE) && currentMethod.getFormalParams().isEmpty()) { node.getMethods().remove(i); break; } } }
@Override public void caseADefaultClassDeclIR(ADefaultClassDeclIR node) throws AnalysisException { node.getMethods().add(creator.generateToString(node)); } }
private void checkRunReturnType(ADefaultClassDeclIR classCg) { isVoidRun = false; for (AMethodDeclIR m : classCg.getMethods()) { if (m.getName().equals("Run") && m.getMethodType().getResult() instanceof AVoidTypeIR) { isVoidRun = true; } } }
public void handleClass(ADefaultClassDeclIR node) throws AnalysisException { // We want only to treat fields and methods specified by the user. // This case helps us avoiding visiting invariant methods for (AFieldDeclIR f : node.getFields()) { f.apply(decorator); } for (AMethodDeclIR m : node.getMethods()) { m.apply(decorator); } }
public ADefaultClassDeclIR consQuoteValue(String quoteClassName, String quoteName, String userCodePackage) { quoteClassName = quoteClassName + JavaQuoteValueCreator.JAVA_QUOTE_NAME_SUFFIX; ADefaultClassDeclIR decl = new ADefaultClassDeclIR(); decl.setAbstract(false); decl.setAccess(IJavaConstants.PUBLIC); decl.setName(quoteClassName); decl.setStatic(false); // The package where the quotes are put is userCode.quotes String quotePackage = consQuotePackage(userCodePackage); decl.setPackage(quotePackage); decl.getFields().add(consHashcodeField()); decl.getFields().add(consInstanceField(quoteClassName)); decl.getMethods().add(consQuoteCtor(quoteClassName)); decl.getMethods().add(consGetInstanceMethod(quoteClassName)); decl.getMethods().add(consHashcodeMethod()); decl.getMethods().add(consEqualsMethod(quoteClassName)); decl.getMethods().add(consToStringMethod(quoteName)); List<ClonableString> imports = new LinkedList<>(); imports.add(new ClonableString(JavaCodeGen.RUNTIME_IMPORT)); decl.setDependencies(imports); return decl; }
@Override public void caseANamedTraceDeclIR(ANamedTraceDeclIR node) throws AnalysisException { if (!transAssistant.getInfo().getSettings().generateTraces()) { return; } TraceSupportedAnalysis supportedAnalysis = new TraceSupportedAnalysis(node); if (!traceIsSupported(supportedAnalysis)) { transAssistant.getInfo().addTransformationWarning(node, supportedAnalysis.getReason()); return; } ADefaultClassDeclIR enclosingClass = node.getAncestor(ADefaultClassDeclIR.class); if (enclosingClass != null) { enclosingClass.getMethods().add(consTraceMethod(node)); } else { log.error("Class enclosing trace could not be found so the generated trace could not be added as a method to the corresponding class"); } }
List<AMethodDeclIR> copy = new ArrayList<AMethodDeclIR>(node.getMethods()); for( AMethodDeclIR e : copy)
List<AMethodDeclIR> copy = new ArrayList<AMethodDeclIR>(node.getMethods()); for( AMethodDeclIR e : copy)
List<AMethodDeclIR> copy = new ArrayList<AMethodDeclIR>(node.getMethods()); for( AMethodDeclIR e : copy)
enclosingClass.getMethods().add(preCondMethod); enclosingClass.getMethods().add(postCondMethod); } else { info.addTransformationWarning(postCondMethod, "Generation of a post condition is only supported for static operations");
@Override public void caseADefaultClassDeclIR(ADefaultClassDeclIR node) throws AnalysisException { if (isBridgeClass(node)) { for (AMethodDeclIR m : node.getMethods()) { if (isDelegateCall(m.getBody())) { log.debug("Updating " + node.getName() + "." + m.getName() + " to use delegate method " + getFullDelegateName(node) + "." + m.getName()); assist.replaceNodeWith(m.getBody(), consDelegateCall(node.getName(), m)); } } } }
LinkedList<AMethodDeclIR> methods = encClass.getMethods();
List<AMethodDeclIR> copy = new ArrayList<AMethodDeclIR>(node.getMethods()); for( AMethodDeclIR e : copy)
List<AMethodDeclIR> copy = new ArrayList<AMethodDeclIR>(node.getMethods()); for( AMethodDeclIR e : copy)
enclosingClass.getMethods().add(method);
public void addTestAnnotations(ADefaultClassDeclIR node) { NodeAssistantIR nodeAssist = assist.getInfo().getNodeAssistant(); for (AMethodDeclIR m : node.getMethods()) { if (isTestMethod(m)) { nodeAssist.addMetaData(m, str2meta(TEST_ANNOTATION), false); } else if(isSetup(m)) { nodeAssist.addMetaData(m, str2meta(TEST_SETUP_ANNOTATION), false); } else if(isTearDown(m)) { nodeAssist.addMetaData(m, str2meta(TEST_TEARDOWN_ANNOTATION), false); } } }
clazz.getMethods().add(privConstructor); method.setStatic(true); clazz.getMethods().add(method);
classCg.getMethods().addFirst(objInitializer);
for (AMethodDeclIR m : clazz.getMethods())