spoon.support.compiler.jdt.JDTBasedSpoonCompiler Java Examples
The following examples show how to use
spoon.support.compiler.jdt.JDTBasedSpoonCompiler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CodeFeatureDetectorTest.java From coming with MIT License | 6 votes |
protected CtType getCtType(SpoonResource resource) { Factory factory = createFactory(); factory.getModel().setBuildModelIsFinished(false); SpoonModelBuilder compiler = new JDTBasedSpoonCompiler(factory); compiler.getFactory().getEnvironment().setLevel("OFF"); compiler.addInputSource(resource); compiler.build(); if (factory.Type().getAll().size() == 0) { return null; } // let's first take the first type. CtType type = factory.Type().getAll().get(0); // Now, let's ask to the factory the type (which it will set up the // corresponding // package) return factory.Type().get(type.getQualifiedName()); }
Example #2
Source File: AstComparator.java From gumtree-spoon-ast-diff with Apache License 2.0 | 6 votes |
public CtType getCtType(SpoonResource resource) { Factory factory = createFactory(); factory.getModel().setBuildModelIsFinished(false); SpoonModelBuilder compiler = new JDTBasedSpoonCompiler(factory); compiler.getFactory().getEnvironment().setLevel("OFF"); compiler.addInputSource(resource); compiler.build(); if (factory.Type().getAll().size() == 0) { return null; } // let's first take the first type. CtType type = factory.Type().getAll().get(0); // Now, let's ask to the factory the type (which it will set up the // corresponding // package) return factory.Type().get(type.getQualifiedName()); }
Example #3
Source File: AstComparatorTest.java From gumtree-spoon-ast-diff with Apache License 2.0 | 4 votes |
public static CtType<?> getCtType(Factory factory, String content) { SpoonModelBuilder compiler = new JDTBasedSpoonCompiler(factory); compiler.addInputSource(new VirtualFile(content, "/test")); compiler.build(); return factory.Type().getAll().get(0); }