/** * Creates a new Spoon Java compiler in order to process and compile Java * source code. */ public SpoonModelBuilder createCompiler(Factory factory, List<SpoonResource> inputSources, List<SpoonResource> templateSources) { SpoonModelBuilder c = createCompiler(factory); c.addInputSources(inputSources); c.addTemplateSources(templateSources); return c; }
/** * Creates a new Spoon Java compiler with a default factory and a list of * input sources. */ public SpoonModelBuilder createCompiler(List<SpoonResource> inputSources) { SpoonModelBuilder c = createCompiler(factory); c.addInputSources(inputSources); return c; }
public void setArgs(String[] args2) { this.commandLineArgs = args2; if (processed) { throw new SpoonException("You cannot process twice the same launcher instance."); } processed = true; processArguments(); }
/** * Creates a {@link Launcher} using the {@link Factory} returned by {@link #createFactory()}. */ public Launcher() { factory = createFactory(); processArguments(); }
public void ignoreChildrenOf(CtElement element) { if (ignoredParent != null) { throw new SpoonException("Unexpected state. The ignoredParent is already set"); } ignoredParent = element; }
public void checkGenericContracts() { checkParentContract(); // assignments checkAssignmentContracts(); // scanners checkContractCtScanner(); // type parameter reference. checkBoundAndUnboundTypeReference(); } }
/** * Returns the command-line given launching arguments in JSAP format. */ protected final JSAPResult getArguments() { return parseArgs(); }
/** * @param mavenProject the path to the root of the project * @param sourceType the source type (App, test, or all) * @param mvnHome Path to maven install * @param forceRefresh force the regeneration of classpath */ public MavenLauncher(String mavenProject, SOURCE_TYPE sourceType, String mvnHome, boolean forceRefresh) { this.sourceType = sourceType; this.mvnHome = mvnHome; this.forceRefresh = forceRefresh; init(mavenProject, null); }
public void checkBoundAndUnboundTypeReference() { new CtScanner() { @Override public void visitCtTypeParameterReference(CtTypeParameterReference ref) { CtTypeParameter declaration = ref.getDeclaration(); if (declaration != null) { assertEquals(ref.getSimpleName(), declaration.getSimpleName()); } super.visitCtTypeParameterReference(ref); } }.scan(_rootPackage); }
public SpoonModelBuilder createCompiler(Factory factory, List<SpoonResource> inputSources) { SpoonModelBuilder c = createCompiler(factory); c.addInputSources(inputSources); return c; }
/** * calls outputConsumer for each reference of the field */ @Override public <T> void visitCtField(CtField<T> field) { throw new SpoonException("Field scope function is not supported"); }
/** * MavenLauncher constructor that skips maven invocation building * classpath. * * @param mavenProject the path to the root of the project * @param sourceType the source type (App, test, or all) * @param classpath String array containing the classpath elements */ public MavenLauncher(String mavenProject, SOURCE_TYPE sourceType, String[] classpath) { this.sourceType = sourceType; init(mavenProject, classpath); }
@Override public void addResult(T value) { if (this.result != null) { throw new SpoonException("Cannot add second value into single value ConversionContext"); } this.result = value; }
/** * Return the type of the field * for List<String> field the ValueType is List * for String field the ValueType is String * */ public CtTypeReference<?> getTypeOfField() { if (valueType == null) { throw new SpoonException("Model is not initialized yet"); } return valueType; }
public ParameterInfo getCurrentParameter() { if (currentParameter == null) { throw new SpoonException("Parameter name must be defined first by call of #parameter(String) method."); } return currentParameter; }
/** * @param valueConvertor the {@link ValueConvertor} used by reading and writing into parameter values defined by this {@link ParameterInfo} */ public AbstractParameterInfo setValueConvertor(ValueConvertor valueConvertor) { if (valueConvertor == null) { throw new SpoonException("valueConvertor must not be null"); } this.valueConvertor = valueConvertor; return this; }
private <T> T checkNotNull(T o) { if (o == null) { throw new SpoonException("Unexpected null value"); } return o; }
@Override protected List<Object> getEmptyContainer() { throw new SpoonException("ComputedParameterInfo#getEmptyContainer should not be used"); } @Override
private ChainOfMatchersImpl(RootNode firstMatcher, Matchers next) { if (firstMatcher == null) { throw new SpoonException("The firstMatcher Node MUST NOT be null"); } this.firstMatcher = firstMatcher; if (next == null) { throw new SpoonException("The next Node MUST NOT be null"); } this.next = next; }