Package spoon.support
Class StandardEnvironment
java.lang.Object
spoon.support.StandardEnvironment
- All Implemented Interfaces:
Serializable,Environment
This class implements a simple Spoon environment that reports messages in the
standard output stream (Java-compliant).
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from interface spoon.compiler.Environment
Environment.PRETTY_PRINTING_MODE -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new environment with anulldefault file generator. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTells whether Spoon does no checks at all.Creates the default pretty-printer.Creates a pretty-printer that automatically imports used types and turns fully qualified type names into simply qualified names.voiddebugMessage(String message)Logs a debug messagevoidDisable all consistency checks on the AST.Get the directory where binary .class files are createdintGets the Java version compliance level.Get the type of serialization to be used by defaultFileGenerator<? extends CtElement>Returns the default file generator for this environment (gives the default output directory for the created files).Get the encoding used inside the projectGet encoding provider, which is used to detect encoding for each file separatelyintGets the error count from building, processing, and compiling within this environment.booleanReturns the value ot the option ignore-syntax-errors.Returns theClassLoaderwhich is used by JDT and to resolve classes from references.getLevel()Gets the level of loggers asked by the user.Gets the processing manager.get the model change listener that is used to follow the change of the AST.booleanReturns the value ot the option noclasspathReturns the output destination that handles where source files are writtenGet the output typeGet the current pretty-printing mode.getProcessorProperties(String processorName)Returns the properties for a given processor.String[]Returns the source class path of the Spoon model.Returns the directory where source files are writtenGet the spoonProgress logger.intGets the size of the tabulations in the generated source code.intGets the warning count from building, processing, and compiling within this environment.booleanReturns true if we let Spoon handle imports and turn fully qualified type names int simply qualified names.booleanReturns the value of the option enable-comments.booleanReturns the value of the option copy-resources.booleanWhether Spoon currently ignores duplicate declarations of types.booleanTells if the source generator will try to preserve the original line numbers.booleanReturns true if preview language features are enabled.booleanTells if the processing is stopped, generally because one of the processors calledsetProcessingStopped(boolean)after reporting an error.booleanTells if Spoon uses tabulations in the source code.voidThis method should be called to print out a message during the processing.voidHelper method called by a processor to report an error, warning or message as dictated by the severity parameter.voidThis method should be called to report the end of the processing.voidreportProgressMessage(String message)This method should be called to print out a progress message during the processing.voidsetAutoImports(boolean autoImports)Tell to the Java printer to automatically generate imports and use simple names instead of fully-qualified name.voidSet the directory where binary .class files are createdvoidsetCommentEnabled(boolean commentEnabled)Sets the option enable-comments to parse comments of the target project.voidsetComplianceLevel(int level)Sets the Java version compliance level.voidsetCompressionType(CompressionType serializationType)Set the type of serialization to be used by defaultvoidsetCopyResources(boolean copyResources)Sets the option copy-resources to copy all resources in a project on the folder destination.voidsetDebug(boolean debug)voidsetDefaultFileGenerator(FileGenerator<? extends CtElement> defaultFileGenerator)Sets the default file generator for this environment.voidsetEncoding(Charset encoding)Set the encoding to use for parsing source codevoidsetEncodingProvider(EncodingProvider encodingProvider)Set encoding provider, which is used to detect encoding for each file separatelyvoidsetIgnoreDuplicateDeclarations(boolean ignoreDuplicateDeclarations)Set Spoon to ignore duplicate type declarations in a project.voidsetIgnoreSyntaxErrors(boolean ignoreSyntaxErrors)Sets the option ignore-syntax-errors to remove files with any syntax errors or JLS violations from the compilation batch.voidsetInputClassLoader(ClassLoader aClassLoader)Sets a specific classloader for JDT and reference resolutionvoidSets the level of loggers asked by the user.voidsetManager(ProcessingManager manager)Sets the processing manager of this environment.voidsetModelChangeListener(FineModelChangeListener modelChangeListener)Set the model change listenervoidsetNoClasspath(boolean option)Sets the option "noclasspath", use with caution (see explanation below).voidsetOutputDestinationHandler(OutputDestinationHandler outputDestinationHandler)Set the output destination that handles where source files are writtenvoidsetOutputType(OutputType outputType)Set the output type used for processing filesvoidsetPreserveLineNumbers(boolean preserveLineNumbers)When set, the generated source code will try to generate code that preserves the line numbers of the original source code.voidsetPrettyPrinterCreator(Supplier<PrettyPrinter> creator)Sets a custom pretty-printer that overrides the default pretty-printer.voidsetPrettyPrintingMode(Environment.PRETTY_PRINTING_MODE prettyPrintingMode)voidsetPreviewFeaturesEnabled(boolean previewFeaturesEnabled)Set to true to enable latest preview language features.voidsetProcessingStopped(boolean processingStopped)This method can be called to stop the processing and all the remaining tasks.voidsetProcessorProperties(String processorName, ProcessorProperties prop)Sets the properties for a given processor.voidsetShouldCompile(boolean shouldCompile)Sets the compile argument.voidsetSourceClasspath(String[] sourceClasspath)Sets the source class path of the Spoon model.voidsetSourceOutputDirectory(File directory)Sets the directory where source files are writtenvoidsetSpoonProgress(SpoonProgress spoonProgress)voidsetTabulationSize(int tabulationSize)Sets the size of the tabulations in the generated source code.voidsetUseLegacyTypeAdaption(boolean useLegacyTypeAdaption)Sets whether to use the new or legacy and (soon to be) deprecated type adaption.voidsetVerbose(boolean verbose)booleanChecks if we want compile the target source code and get their binary.URL[]Creates a URL class path fromEnvironment.getSourceClasspath()booleanWhether to use the new or legacy and (soon to be) deprecated type adaption.voiduseTabulations(boolean tabulation)Sets Spoon to use tabulations in the source code.
-
Field Details
-
DEFAULT_CODE_COMPLIANCE_LEVEL
public static final int DEFAULT_CODE_COMPLIANCE_LEVEL- See Also:
- Constant Field Values
-
-
Constructor Details
-
StandardEnvironment
public StandardEnvironment()Creates a new environment with anulldefault file generator.
-
-
Method Details
-
getPrettyPrintingMode
Description copied from interface:EnvironmentGet the current pretty-printing mode. most robust:Environment.PRETTY_PRINTING_MODE.DEBUGmost sophisticated:Environment.PRETTY_PRINTING_MODE.AUTOIMPORT- Specified by:
getPrettyPrintingModein interfaceEnvironment- Returns:
- the kind of pretty-printing expected.
-
setPrettyPrintingMode
- Specified by:
setPrettyPrintingModein interfaceEnvironment
-
debugMessage
Description copied from interface:EnvironmentLogs a debug message- Specified by:
debugMessagein interfaceEnvironment- Parameters:
message- a message to write to the debug log
-
isAutoImports
public boolean isAutoImports()Description copied from interface:EnvironmentReturns true if we let Spoon handle imports and turn fully qualified type names int simply qualified names.- Specified by:
isAutoImportsin interfaceEnvironment- Returns:
- true iff Spoon is set to automatically import types and simplify type names
-
setAutoImports
public void setAutoImports(boolean autoImports)Description copied from interface:EnvironmentTell to the Java printer to automatically generate imports and use simple names instead of fully-qualified name.- Specified by:
setAutoImportsin interfaceEnvironment- Parameters:
autoImports- whether Spoon should auto-import types and simplify names
-
getDefaultFileGenerator
Description copied from interface:EnvironmentReturns the default file generator for this environment (gives the default output directory for the created files).- Specified by:
getDefaultFileGeneratorin interfaceEnvironment- Returns:
- the default file generator
-
getLevel
Description copied from interface:EnvironmentGets the level of loggers asked by the user.- Specified by:
getLevelin interfaceEnvironment- Returns:
- the current logging level
-
setLevel
Description copied from interface:EnvironmentSets the level of loggers asked by the user.- Specified by:
setLevelin interfaceEnvironment- Parameters:
level- the logging level to set, seeLevelfor options
-
shouldCompile
public boolean shouldCompile()Description copied from interface:EnvironmentChecks if we want compile the target source code and get their binary.- Specified by:
shouldCompilein interfaceEnvironment- Returns:
- true iff Spoon should compile target source code
-
setShouldCompile
public void setShouldCompile(boolean shouldCompile)Description copied from interface:EnvironmentSets the compile argument.- Specified by:
setShouldCompilein interfaceEnvironment- Parameters:
shouldCompile- whether Spoon should compile target source code
-
checksAreSkipped
public boolean checksAreSkipped()Description copied from interface:EnvironmentTells whether Spoon does no checks at all. - parents are consistent (seeAstParentConsistencyChecker) - hashcode violation (seeCtElementImpl.equals(Object)) - method violation (seeCtType.addMethod(CtMethod)) are active or not. By default all checks are enabled andEnvironment.checksAreSkipped()return false.- Specified by:
checksAreSkippedin interfaceEnvironment- Returns:
- true iff Spoon skips consistency checks
-
disableConsistencyChecks
public void disableConsistencyChecks()Description copied from interface:EnvironmentDisable all consistency checks on the AST. Dangerous! The only valid usage of this is to keep full backward-compatibility.- Specified by:
disableConsistencyChecksin interfaceEnvironment
-
getManager
Description copied from interface:EnvironmentGets the processing manager.- Specified by:
getManagerin interfaceEnvironment- Returns:
- the current processing manager
-
getProcessorProperties
Description copied from interface:EnvironmentReturns the properties for a given processor.- Specified by:
getProcessorPropertiesin interfaceEnvironment- Parameters:
processorName- fully qualified name of a processor- Returns:
- properties for the processor, or
nullif there is no processor by that name
-
isProcessingStopped
public boolean isProcessingStopped()Tells if the processing is stopped, generally because one of the processors calledsetProcessingStopped(boolean)after reporting an error.- Specified by:
isProcessingStoppedin interfaceEnvironment- Returns:
- true iff processing has been forcibly aborted
-
report
Description copied from interface:EnvironmentHelper method called by a processor to report an error, warning or message as dictated by the severity parameter. Note that this does not stop the processing or any remaining task. To do so, useEnvironment.setProcessingStopped(boolean).- Specified by:
reportin interfaceEnvironment- Parameters:
processor- The processor that report this message. Can be null.level- The level of the reportelement- The CtElement to which the report is associatedmessage- The message to report
-
report
Description copied from interface:EnvironmentThis method should be called to print out a message during the processing.- Specified by:
reportin interfaceEnvironment- Parameters:
processor- The processor that report this message. Can be null.level- The level of the reportmessage- The message to report
-
reportEnd
public void reportEnd()This method should be called to report the end of the processing.- Specified by:
reportEndin interfaceEnvironment
-
reportProgressMessage
Description copied from interface:EnvironmentThis method should be called to print out a progress message during the processing. On contrary to regular messages, progress messages are not meant to remain in the message logs and just indicate to the user some task progression information.- Specified by:
reportProgressMessagein interfaceEnvironment- Parameters:
message- a message to print
-
setDebug
public void setDebug(boolean debug) -
setDefaultFileGenerator
Description copied from interface:EnvironmentSets the default file generator for this environment.- Specified by:
setDefaultFileGeneratorin interfaceEnvironment- Parameters:
defaultFileGenerator- a file generator to set as the default
-
setManager
Description copied from interface:EnvironmentSets the processing manager of this environment.- Specified by:
setManagerin interfaceEnvironment- Parameters:
manager- a processing manager to set as the default
-
setProcessingStopped
public void setProcessingStopped(boolean processingStopped)Description copied from interface:EnvironmentThis method can be called to stop the processing and all the remaining tasks. In general, a processor calls it after reporting a fatal error.- Specified by:
setProcessingStoppedin interfaceEnvironment- Parameters:
processingStopped- if true, any ongoing processing is aborted as soon as possible and future processing is prohibited
-
setVerbose
public void setVerbose(boolean verbose) -
getComplianceLevel
public int getComplianceLevel()Description copied from interface:EnvironmentGets the Java version compliance level.- Specified by:
getComplianceLevelin interfaceEnvironment- Returns:
- the compliance level
-
setComplianceLevel
public void setComplianceLevel(int level)Description copied from interface:EnvironmentSets the Java version compliance level.- Specified by:
setComplianceLevelin interfaceEnvironment- Parameters:
level- the compliance level
-
isPreviewFeaturesEnabled
public boolean isPreviewFeaturesEnabled()Description copied from interface:EnvironmentReturns true if preview language features are enabled.- Specified by:
isPreviewFeaturesEnabledin interfaceEnvironment- Returns:
- true iff preview features are enabled
-
setPreviewFeaturesEnabled
public void setPreviewFeaturesEnabled(boolean previewFeaturesEnabled)Description copied from interface:EnvironmentSet to true to enable latest preview language features. Note: compliance level should be set to the latest.- Specified by:
setPreviewFeaturesEnabledin interfaceEnvironment- Parameters:
previewFeaturesEnabled- whether to enable preview features
-
setProcessorProperties
Description copied from interface:EnvironmentSets the properties for a given processor.- Specified by:
setProcessorPropertiesin interfaceEnvironment- Parameters:
processorName- fully qualified name of the processorprop- properties to set
-
isUsingTabulations
public boolean isUsingTabulations()Description copied from interface:EnvironmentTells if Spoon uses tabulations in the source code.- Specified by:
isUsingTabulationsin interfaceEnvironment- Returns:
- true iff Spoon uses tabulations when pretty-printing
-
useTabulations
public void useTabulations(boolean tabulation)Description copied from interface:EnvironmentSets Spoon to use tabulations in the source code.- Specified by:
useTabulationsin interfaceEnvironment- Parameters:
tabulation- whether Spoon should use tabulations when pretty-printing
-
getTabulationSize
public int getTabulationSize()Description copied from interface:EnvironmentGets the size of the tabulations in the generated source code.- Specified by:
getTabulationSizein interfaceEnvironment- Returns:
- the current tabulation size
-
setTabulationSize
public void setTabulationSize(int tabulationSize)Description copied from interface:EnvironmentSets the size of the tabulations in the generated source code.- Specified by:
setTabulationSizein interfaceEnvironment- Parameters:
tabulationSize- tabulation size to set
-
setInputClassLoader
Description copied from interface:EnvironmentSets a specific classloader for JDT and reference resolution- Specified by:
setInputClassLoaderin interfaceEnvironment- Parameters:
aClassLoader- a classloader to set
-
getInputClassLoader
Description copied from interface:EnvironmentReturns theClassLoaderwhich is used by JDT and to resolve classes from references. By default, returns a class loader able to load classes from the Spoon-specific class path set withEnvironment.setSourceClasspath(String[])- Specified by:
getInputClassLoaderin interfaceEnvironment- Returns:
- the currently configured classloader
-
urlClasspath
Creates a URL class path fromEnvironment.getSourceClasspath() -
getSourceClasspath
Description copied from interface:EnvironmentReturns the source class path of the Spoon model. This class path is used when the SpoonCompiler is building the model and also to find external classes, referenced from within the model.- Specified by:
getSourceClasspathin interfaceEnvironment- Returns:
- all paths in the classpath
-
setSourceClasspath
Description copied from interface:EnvironmentSets the source class path of the Spoon model. After the class path is set, it can be retrieved byEnvironment.getSourceClasspath(). Only .jar files or directories with *.class files are accepted. The *.jar or *.java files contained in given directories are ignored.- Specified by:
setSourceClasspathin interfaceEnvironment- Parameters:
sourceClasspath- classpath to set
-
getErrorCount
public int getErrorCount()Description copied from interface:EnvironmentGets the error count from building, processing, and compiling within this environment.- Specified by:
getErrorCountin interfaceEnvironment- Returns:
- the amount of errors that have occurred
-
getWarningCount
public int getWarningCount()Description copied from interface:EnvironmentGets the warning count from building, processing, and compiling within this environment.- Specified by:
getWarningCountin interfaceEnvironment- Returns:
- the amount of warnings that have occurred
-
isPreserveLineNumbers
public boolean isPreserveLineNumbers()Description copied from interface:EnvironmentTells if the source generator will try to preserve the original line numbers.- Specified by:
isPreserveLineNumbersin interfaceEnvironment- Returns:
- true iff Spoon attempts to preserve line numbers of elements when pretty-printing
-
setPreserveLineNumbers
public void setPreserveLineNumbers(boolean preserveLineNumbers)Description copied from interface:EnvironmentWhen set, the generated source code will try to generate code that preserves the line numbers of the original source code. This option may lead to difficult-to-read indentation and formatting.- Specified by:
setPreserveLineNumbersin interfaceEnvironment- Parameters:
preserveLineNumbers- whether Spoon should attempt to preserve line numbers when pretty-printing
-
setNoClasspath
public void setNoClasspath(boolean option)Description copied from interface:EnvironmentSets the option "noclasspath", use with caution (see explanation below). With this option, Spoon does not require the full classpath to build the model. In this case, all references to classes that are not in the classpath are handled with the reference mechanism. The "simplename" of the reference object refers to the unbound identifier. This option facilitates the use of Spoon when it is hard to have the complete and correct classpath, for example for mining software repositories. For writing analyses, this option works well if you don't cross the reference by a call to getDeclaration() (if you really want to do so, then check for nullness of the result before). In normal mode, compilation errors are signaled as exception, with this option enabled they are signaled as message only. The reason is that in most cases, there are necessarily errors related to the missing classpath elements.- Specified by:
setNoClasspathin interfaceEnvironment- Parameters:
option- whether to set Spoon to noclasspath mode
-
getNoClasspath
public boolean getNoClasspath()Description copied from interface:EnvironmentReturns the value ot the option noclasspath- Specified by:
getNoClasspathin interfaceEnvironment- Returns:
- true iff Spoon is currently in noclasspath mode
-
setIgnoreSyntaxErrors
public void setIgnoreSyntaxErrors(boolean ignoreSyntaxErrors)Description copied from interface:EnvironmentSets the option ignore-syntax-errors to remove files with any syntax errors or JLS violations from the compilation batch. Also while transformations no checks for JLS correctness are reported as error.- Specified by:
setIgnoreSyntaxErrorsin interfaceEnvironment- Parameters:
ignoreSyntaxErrors- whether Spoon should ignore files with any syntax errors or JLS violations
-
getIgnoreSyntaxErrors
public boolean getIgnoreSyntaxErrors()Description copied from interface:EnvironmentReturns the value ot the option ignore-syntax-errors.- Specified by:
getIgnoreSyntaxErrorsin interfaceEnvironment- Returns:
- true iff Spoon ignores files with any syntax errors, JLS violations or reports JLS correctness problems as exception.
-
isCopyResources
public boolean isCopyResources()Description copied from interface:EnvironmentReturns the value of the option copy-resources.- Specified by:
isCopyResourcesin interfaceEnvironment- Returns:
- true iff Spoon should copy resource files from the project when pretty-printing
-
setCopyResources
public void setCopyResources(boolean copyResources)Description copied from interface:EnvironmentSets the option copy-resources to copy all resources in a project on the folder destination.- Specified by:
setCopyResourcesin interfaceEnvironment- Parameters:
copyResources- whether Spoon should copy resources
-
isCommentsEnabled
public boolean isCommentsEnabled()Description copied from interface:EnvironmentReturns the value of the option enable-comments.- Specified by:
isCommentsEnabledin interfaceEnvironment- Returns:
- true iff Spoon respects comments in source code
-
setCommentEnabled
public void setCommentEnabled(boolean commentEnabled)Description copied from interface:EnvironmentSets the option enable-comments to parse comments of the target project.- Specified by:
setCommentEnabledin interfaceEnvironment- Parameters:
commentEnabled- whether Spoon should respect comments in source code
-
setBinaryOutputDirectory
Description copied from interface:EnvironmentSet the directory where binary .class files are created- Specified by:
setBinaryOutputDirectoryin interfaceEnvironment- Parameters:
s- path to set for the binary output directory
-
getBinaryOutputDirectory
Description copied from interface:EnvironmentGet the directory where binary .class files are created- Specified by:
getBinaryOutputDirectoryin interfaceEnvironment- Returns:
- path to the binary output directory
-
setSourceOutputDirectory
Description copied from interface:EnvironmentSets the directory where source files are written- Specified by:
setSourceOutputDirectoryin interfaceEnvironment- Parameters:
directory- path to set for the source output directory
-
getSourceOutputDirectory
Description copied from interface:EnvironmentReturns the directory where source files are written- Specified by:
getSourceOutputDirectoryin interfaceEnvironment- Returns:
- path to the source output directory
-
setOutputDestinationHandler
Description copied from interface:EnvironmentSet the output destination that handles where source files are written- Specified by:
setOutputDestinationHandlerin interfaceEnvironment- Parameters:
outputDestinationHandler- handler for determining where to write source files
-
getOutputDestinationHandler
Description copied from interface:EnvironmentReturns the output destination that handles where source files are written- Specified by:
getOutputDestinationHandlerin interfaceEnvironment- Returns:
- the current output destination handler
-
getModelChangeListener
Description copied from interface:Environmentget the model change listener that is used to follow the change of the AST.- Specified by:
getModelChangeListenerin interfaceEnvironment- Returns:
- the current change listener
-
setModelChangeListener
Description copied from interface:EnvironmentSet the model change listener- Specified by:
setModelChangeListenerin interfaceEnvironment- Parameters:
modelChangeListener- change listener to set
-
getEncoding
Description copied from interface:EnvironmentGet the encoding used inside the project- Specified by:
getEncodingin interfaceEnvironment- Returns:
- encoding used in the project
-
getEncodingProvider
Description copied from interface:EnvironmentGet encoding provider, which is used to detect encoding for each file separately- Specified by:
getEncodingProviderin interfaceEnvironment- Returns:
- the current encoding provider
-
setEncoding
Description copied from interface:EnvironmentSet the encoding to use for parsing source code- Specified by:
setEncodingin interfaceEnvironment- Parameters:
encoding- the character set to use for source file encoding
-
setEncodingProvider
Description copied from interface:EnvironmentSet encoding provider, which is used to detect encoding for each file separately- Specified by:
setEncodingProviderin interfaceEnvironment- Parameters:
encodingProvider- the encoding provider to set
-
setOutputType
Description copied from interface:EnvironmentSet the output type used for processing files- Specified by:
setOutputTypein interfaceEnvironment- Parameters:
outputType- output type to use when pretty-printing
-
getOutputType
Description copied from interface:EnvironmentGet the output type- Specified by:
getOutputTypein interfaceEnvironment- Returns:
- the current output type
-
getSpoonProgress
Description copied from interface:EnvironmentGet the spoonProgress logger. This method mustn't return null.- Specified by:
getSpoonProgressin interfaceEnvironment- Returns:
- the spoonProgress
-
setSpoonProgress
- Specified by:
setSpoonProgressin interfaceEnvironment
-
getCompressionType
Description copied from interface:EnvironmentGet the type of serialization to be used by default- Specified by:
getCompressionTypein interfaceEnvironment- Returns:
- the current type of serialization
-
setCompressionType
Description copied from interface:EnvironmentSet the type of serialization to be used by default- Specified by:
setCompressionTypein interfaceEnvironment- Parameters:
serializationType- the type of serialization to set
-
createPrettyPrinterAutoImport
Description copied from interface:EnvironmentCreates a pretty-printer that automatically imports used types and turns fully qualified type names into simply qualified names. This is roughly equivalent to settingEnvironment.setAutoImports(boolean)totrueand then invokinEnvironment.createPrettyPrinter(), except that the environment is not modified.- Specified by:
createPrettyPrinterAutoImportin interfaceEnvironment- Returns:
- new instance of
PrettyPrinterwhich prints nice code
-
createPrettyPrinter
Description copied from interface:EnvironmentCreates the default pretty-printer.- Specified by:
createPrettyPrinterin interfaceEnvironment- Returns:
- new instance of
PrettyPrinterwhich is configured for this environment
-
setPrettyPrinterCreator
Description copied from interface:EnvironmentSets a custom pretty-printer that overrides the default pretty-printer. Can for example be used to create aSniperJavaPrettyPrinterfor enabling the sniper mode.env.setPrettyPrinterCreator(() -> new SniperJavaPrettyPrinter(env));- Specified by:
setPrettyPrinterCreatorin interfaceEnvironment- Parameters:
creator- aSupplier, which creates new instance of pretty printer.
-
useLegacyTypeAdaption
public boolean useLegacyTypeAdaption()Description copied from interface:EnvironmentWhether to use the new or legacy and (soon to be) deprecated type adaption. You should not use this method.- Specified by:
useLegacyTypeAdaptionin interfaceEnvironment- Returns:
- true if spoon uses the old and (soon to be) deprecated type adaption.
-
setUseLegacyTypeAdaption
public void setUseLegacyTypeAdaption(boolean useLegacyTypeAdaption)Description copied from interface:EnvironmentSets whether to use the new or legacy and (soon to be) deprecated type adaption. You should not use this method.- Specified by:
setUseLegacyTypeAdaptionin interfaceEnvironment- Parameters:
useLegacyTypeAdaption- whether to use the old type adaption implementation
-
isIgnoreDuplicateDeclarations
public boolean isIgnoreDuplicateDeclarations()Description copied from interface:EnvironmentWhether Spoon currently ignores duplicate declarations of types.- Specified by:
isIgnoreDuplicateDeclarationsin interfaceEnvironment- Returns:
- true if spoon is allowed to create a model of a project that contains multiple copies of the same class
-
setIgnoreDuplicateDeclarations
public void setIgnoreDuplicateDeclarations(boolean ignoreDuplicateDeclarations)Description copied from interface:EnvironmentSet Spoon to ignore duplicate type declarations in a project. Setting this option totruecauses Spoon to attempt to build a model even when the same qualified name appears for multiple types. This mode of operation makes Spoon less stable as duplicated types do not make sense in Java, and causes strange behavior in the underlying JDT compiler. Type resolution can become unpredictable as the order in which types are parsed becomes a determining factor in which duplicated type actually makes it into the model.- Specified by:
setIgnoreDuplicateDeclarationsin interfaceEnvironment- Parameters:
ignoreDuplicateDeclarations- (default false) set to true to allow spoon to create a model of a project that contains multiple times the same class
-