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
-
Constructor Summary
ConstructorDescriptionCreates a new environment with anull
default file generator. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Tells 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.void
debugMessage(String message)
Logs a debug messagevoid
Disable all consistency checks on the AST.Get the directory where binary .class files are createdint
Gets 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 separatelyint
Gets the error count from building, processing, and compiling within this environment.boolean
Returns the value ot the option ignore-syntax-errors.Returns theClassLoader
which 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.boolean
Returns 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.int
Gets the size of the tabulations in the generated source code.int
Gets the warning count from building, processing, and compiling within this environment.boolean
Returns true if we let Spoon handle imports and turn fully qualified type names int simply qualified names.boolean
Returns the value of the option enable-comments.boolean
Returns the value of the option copy-resources.boolean
Whether Spoon currently ignores duplicate declarations of types.boolean
Tells if the source generator will try to preserve the original line numbers.boolean
Returns true if preview language features are enabled.boolean
Tells if the processing is stopped, generally because one of the processors calledsetProcessingStopped(boolean)
after reporting an error.boolean
Tells if Spoon uses tabulations in the source code.void
This method should be called to print out a message during the processing.void
Helper method called by a processor to report an error, warning or message as dictated by the severity parameter.void
This method should be called to report the end of the processing.void
reportProgressMessage(String message)
This method should be called to print out a progress message during the processing.void
setAutoImports(boolean autoImports)
Tell to the Java printer to automatically generate imports and use simple names instead of fully-qualified name.void
Set the directory where binary .class files are createdvoid
setCommentEnabled(boolean commentEnabled)
Sets the option enable-comments to parse comments of the target project.void
setComplianceLevel(int level)
Sets the Java version compliance level.void
setCompressionType(CompressionType serializationType)
Set the type of serialization to be used by defaultvoid
setCopyResources(boolean copyResources)
Sets the option copy-resources to copy all resources in a project on the folder destination.void
setDebug(boolean debug)
void
setDefaultFileGenerator(FileGenerator<? extends CtElement> defaultFileGenerator)
Sets the default file generator for this environment.void
setEncoding(Charset encoding)
Set the encoding to use for parsing source codevoid
setEncodingProvider(EncodingProvider encodingProvider)
Set encoding provider, which is used to detect encoding for each file separatelyvoid
setIgnoreDuplicateDeclarations(boolean ignoreDuplicateDeclarations)
Set Spoon to ignore duplicate type declarations in a project.void
setIgnoreSyntaxErrors(boolean ignoreSyntaxErrors)
Sets the option ignore-syntax-errors to remove files with any syntax errors or JLS violations from the compilation batch.void
setInputClassLoader(ClassLoader aClassLoader)
Sets a specific classloader for JDT and reference resolutionvoid
Sets the level of loggers asked by the user.void
setManager(ProcessingManager manager)
Sets the processing manager of this environment.void
setModelChangeListener(FineModelChangeListener modelChangeListener)
Set the model change listenervoid
setNoClasspath(boolean option)
Sets the option "noclasspath", use with caution (see explanation below).void
setOutputDestinationHandler(OutputDestinationHandler outputDestinationHandler)
Set the output destination that handles where source files are writtenvoid
setOutputType(OutputType outputType)
Set the output type used for processing filesvoid
setPreserveLineNumbers(boolean preserveLineNumbers)
When set, the generated source code will try to generate code that preserves the line numbers of the original source code.void
setPrettyPrinterCreator(Supplier<PrettyPrinter> creator)
Sets a custom pretty-printer that overrides the default pretty-printer.void
setPrettyPrintingMode(Environment.PRETTY_PRINTING_MODE prettyPrintingMode)
void
setPreviewFeaturesEnabled(boolean previewFeaturesEnabled)
Set to true to enable latest preview language features.void
setProcessingStopped(boolean processingStopped)
This method can be called to stop the processing and all the remaining tasks.void
setProcessorProperties(String processorName, ProcessorProperties prop)
Sets the properties for a given processor.void
setShouldCompile(boolean shouldCompile)
Sets the compile argument.void
setSourceClasspath(String[] sourceClasspath)
Sets the source class path of the Spoon model.void
setSourceOutputDirectory(File directory)
Sets the directory where source files are writtenvoid
setSpoonProgress(SpoonProgress spoonProgress)
void
setTabulationSize(int tabulationSize)
Sets the size of the tabulations in the generated source code.void
setUseLegacyTypeAdaption(boolean useLegacyTypeAdaption)
Sets whether to use the new or legacy and (soon to be) deprecated type adaption.void
setVerbose(boolean verbose)
boolean
Checks if we want compile the target source code and get their binary.URL[]
Creates a URL class path fromEnvironment.getSourceClasspath()
boolean
Whether to use the new or legacy and (soon to be) deprecated type adaption.void
useTabulations(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 anull
default file generator.
-
-
Method Details
-
getPrettyPrintingMode
Description copied from interface:Environment
Get the current pretty-printing mode. most robust:Environment.PRETTY_PRINTING_MODE.DEBUG
most sophisticated:Environment.PRETTY_PRINTING_MODE.AUTOIMPORT
- Specified by:
getPrettyPrintingMode
in interfaceEnvironment
- Returns:
- the kind of pretty-printing expected.
-
setPrettyPrintingMode
- Specified by:
setPrettyPrintingMode
in interfaceEnvironment
-
debugMessage
Description copied from interface:Environment
Logs a debug message- Specified by:
debugMessage
in interfaceEnvironment
- Parameters:
message
- a message to write to the debug log
-
isAutoImports
public boolean isAutoImports()Description copied from interface:Environment
Returns true if we let Spoon handle imports and turn fully qualified type names int simply qualified names.- Specified by:
isAutoImports
in 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:Environment
Tell to the Java printer to automatically generate imports and use simple names instead of fully-qualified name.- Specified by:
setAutoImports
in interfaceEnvironment
- Parameters:
autoImports
- whether Spoon should auto-import types and simplify names
-
getDefaultFileGenerator
Description copied from interface:Environment
Returns the default file generator for this environment (gives the default output directory for the created files).- Specified by:
getDefaultFileGenerator
in interfaceEnvironment
- Returns:
- the default file generator
-
getLevel
Description copied from interface:Environment
Gets the level of loggers asked by the user.- Specified by:
getLevel
in interfaceEnvironment
- Returns:
- the current logging level
-
setLevel
Description copied from interface:Environment
Sets the level of loggers asked by the user.- Specified by:
setLevel
in interfaceEnvironment
- Parameters:
level
- the logging level to set, seeLevel
for options
-
shouldCompile
public boolean shouldCompile()Description copied from interface:Environment
Checks if we want compile the target source code and get their binary.- Specified by:
shouldCompile
in interfaceEnvironment
- Returns:
- true iff Spoon should compile target source code
-
setShouldCompile
public void setShouldCompile(boolean shouldCompile)Description copied from interface:Environment
Sets the compile argument.- Specified by:
setShouldCompile
in interfaceEnvironment
- Parameters:
shouldCompile
- whether Spoon should compile target source code
-
checksAreSkipped
public boolean checksAreSkipped()Description copied from interface:Environment
Tells 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:
checksAreSkipped
in interfaceEnvironment
- Returns:
- true iff Spoon skips consistency checks
-
disableConsistencyChecks
public void disableConsistencyChecks()Description copied from interface:Environment
Disable all consistency checks on the AST. Dangerous! The only valid usage of this is to keep full backward-compatibility.- Specified by:
disableConsistencyChecks
in interfaceEnvironment
-
getManager
Description copied from interface:Environment
Gets the processing manager.- Specified by:
getManager
in interfaceEnvironment
- Returns:
- the current processing manager
-
getProcessorProperties
Description copied from interface:Environment
Returns the properties for a given processor.- Specified by:
getProcessorProperties
in interfaceEnvironment
- Parameters:
processorName
- fully qualified name of a processor- Returns:
- properties for the processor, or
null
if 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:
isProcessingStopped
in interfaceEnvironment
- Returns:
- true iff processing has been forcibly aborted
-
report
Description copied from interface:Environment
Helper 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:
report
in 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:Environment
This method should be called to print out a message during the processing.- Specified by:
report
in 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:
reportEnd
in interfaceEnvironment
-
reportProgressMessage
Description copied from interface:Environment
This 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:
reportProgressMessage
in interfaceEnvironment
- Parameters:
message
- a message to print
-
setDebug
public void setDebug(boolean debug) -
setDefaultFileGenerator
Description copied from interface:Environment
Sets the default file generator for this environment.- Specified by:
setDefaultFileGenerator
in interfaceEnvironment
- Parameters:
defaultFileGenerator
- a file generator to set as the default
-
setManager
Description copied from interface:Environment
Sets the processing manager of this environment.- Specified by:
setManager
in interfaceEnvironment
- Parameters:
manager
- a processing manager to set as the default
-
setProcessingStopped
public void setProcessingStopped(boolean processingStopped)Description copied from interface:Environment
This 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:
setProcessingStopped
in 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:Environment
Gets the Java version compliance level.- Specified by:
getComplianceLevel
in interfaceEnvironment
- Returns:
- the compliance level
-
setComplianceLevel
public void setComplianceLevel(int level)Description copied from interface:Environment
Sets the Java version compliance level.- Specified by:
setComplianceLevel
in interfaceEnvironment
- Parameters:
level
- the compliance level
-
isPreviewFeaturesEnabled
public boolean isPreviewFeaturesEnabled()Description copied from interface:Environment
Returns true if preview language features are enabled.- Specified by:
isPreviewFeaturesEnabled
in interfaceEnvironment
- Returns:
- true iff preview features are enabled
-
setPreviewFeaturesEnabled
public void setPreviewFeaturesEnabled(boolean previewFeaturesEnabled)Description copied from interface:Environment
Set to true to enable latest preview language features. Note: compliance level should be set to the latest.- Specified by:
setPreviewFeaturesEnabled
in interfaceEnvironment
- Parameters:
previewFeaturesEnabled
- whether to enable preview features
-
setProcessorProperties
Description copied from interface:Environment
Sets the properties for a given processor.- Specified by:
setProcessorProperties
in interfaceEnvironment
- Parameters:
processorName
- fully qualified name of the processorprop
- properties to set
-
isUsingTabulations
public boolean isUsingTabulations()Description copied from interface:Environment
Tells if Spoon uses tabulations in the source code.- Specified by:
isUsingTabulations
in interfaceEnvironment
- Returns:
- true iff Spoon uses tabulations when pretty-printing
-
useTabulations
public void useTabulations(boolean tabulation)Description copied from interface:Environment
Sets Spoon to use tabulations in the source code.- Specified by:
useTabulations
in interfaceEnvironment
- Parameters:
tabulation
- whether Spoon should use tabulations when pretty-printing
-
getTabulationSize
public int getTabulationSize()Description copied from interface:Environment
Gets the size of the tabulations in the generated source code.- Specified by:
getTabulationSize
in interfaceEnvironment
- Returns:
- the current tabulation size
-
setTabulationSize
public void setTabulationSize(int tabulationSize)Description copied from interface:Environment
Sets the size of the tabulations in the generated source code.- Specified by:
setTabulationSize
in interfaceEnvironment
- Parameters:
tabulationSize
- tabulation size to set
-
setInputClassLoader
Description copied from interface:Environment
Sets a specific classloader for JDT and reference resolution- Specified by:
setInputClassLoader
in interfaceEnvironment
- Parameters:
aClassLoader
- a classloader to set
-
getInputClassLoader
Description copied from interface:Environment
Returns theClassLoader
which 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:
getInputClassLoader
in interfaceEnvironment
- Returns:
- the currently configured classloader
-
urlClasspath
Creates a URL class path fromEnvironment.getSourceClasspath()
-
getSourceClasspath
Description copied from interface:Environment
Returns 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:
getSourceClasspath
in interfaceEnvironment
- Returns:
- all paths in the classpath
-
setSourceClasspath
Description copied from interface:Environment
Sets 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:
setSourceClasspath
in interfaceEnvironment
- Parameters:
sourceClasspath
- classpath to set
-
getErrorCount
public int getErrorCount()Description copied from interface:Environment
Gets the error count from building, processing, and compiling within this environment.- Specified by:
getErrorCount
in interfaceEnvironment
- Returns:
- the amount of errors that have occurred
-
getWarningCount
public int getWarningCount()Description copied from interface:Environment
Gets the warning count from building, processing, and compiling within this environment.- Specified by:
getWarningCount
in interfaceEnvironment
- Returns:
- the amount of warnings that have occurred
-
isPreserveLineNumbers
public boolean isPreserveLineNumbers()Description copied from interface:Environment
Tells if the source generator will try to preserve the original line numbers.- Specified by:
isPreserveLineNumbers
in 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:Environment
When 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:
setPreserveLineNumbers
in interfaceEnvironment
- Parameters:
preserveLineNumbers
- whether Spoon should attempt to preserve line numbers when pretty-printing
-
setNoClasspath
public void setNoClasspath(boolean option)Description copied from interface:Environment
Sets 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:
setNoClasspath
in interfaceEnvironment
- Parameters:
option
- whether to set Spoon to noclasspath mode
-
getNoClasspath
public boolean getNoClasspath()Description copied from interface:Environment
Returns the value ot the option noclasspath- Specified by:
getNoClasspath
in interfaceEnvironment
- Returns:
- true iff Spoon is currently in noclasspath mode
-
setIgnoreSyntaxErrors
public void setIgnoreSyntaxErrors(boolean ignoreSyntaxErrors)Description copied from interface:Environment
Sets 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:
setIgnoreSyntaxErrors
in interfaceEnvironment
- Parameters:
ignoreSyntaxErrors
- whether Spoon should ignore files with any syntax errors or JLS violations
-
getIgnoreSyntaxErrors
public boolean getIgnoreSyntaxErrors()Description copied from interface:Environment
Returns the value ot the option ignore-syntax-errors.- Specified by:
getIgnoreSyntaxErrors
in 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:Environment
Returns the value of the option copy-resources.- Specified by:
isCopyResources
in 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:Environment
Sets the option copy-resources to copy all resources in a project on the folder destination.- Specified by:
setCopyResources
in interfaceEnvironment
- Parameters:
copyResources
- whether Spoon should copy resources
-
isCommentsEnabled
public boolean isCommentsEnabled()Description copied from interface:Environment
Returns the value of the option enable-comments.- Specified by:
isCommentsEnabled
in interfaceEnvironment
- Returns:
- true iff Spoon respects comments in source code
-
setCommentEnabled
public void setCommentEnabled(boolean commentEnabled)Description copied from interface:Environment
Sets the option enable-comments to parse comments of the target project.- Specified by:
setCommentEnabled
in interfaceEnvironment
- Parameters:
commentEnabled
- whether Spoon should respect comments in source code
-
setBinaryOutputDirectory
Description copied from interface:Environment
Set the directory where binary .class files are created- Specified by:
setBinaryOutputDirectory
in interfaceEnvironment
- Parameters:
s
- path to set for the binary output directory
-
getBinaryOutputDirectory
Description copied from interface:Environment
Get the directory where binary .class files are created- Specified by:
getBinaryOutputDirectory
in interfaceEnvironment
- Returns:
- path to the binary output directory
-
setSourceOutputDirectory
Description copied from interface:Environment
Sets the directory where source files are written- Specified by:
setSourceOutputDirectory
in interfaceEnvironment
- Parameters:
directory
- path to set for the source output directory
-
getSourceOutputDirectory
Description copied from interface:Environment
Returns the directory where source files are written- Specified by:
getSourceOutputDirectory
in interfaceEnvironment
- Returns:
- path to the source output directory
-
setOutputDestinationHandler
Description copied from interface:Environment
Set the output destination that handles where source files are written- Specified by:
setOutputDestinationHandler
in interfaceEnvironment
- Parameters:
outputDestinationHandler
- handler for determining where to write source files
-
getOutputDestinationHandler
Description copied from interface:Environment
Returns the output destination that handles where source files are written- Specified by:
getOutputDestinationHandler
in interfaceEnvironment
- Returns:
- the current output destination handler
-
getModelChangeListener
Description copied from interface:Environment
get the model change listener that is used to follow the change of the AST.- Specified by:
getModelChangeListener
in interfaceEnvironment
- Returns:
- the current change listener
-
setModelChangeListener
Description copied from interface:Environment
Set the model change listener- Specified by:
setModelChangeListener
in interfaceEnvironment
- Parameters:
modelChangeListener
- change listener to set
-
getEncoding
Description copied from interface:Environment
Get the encoding used inside the project- Specified by:
getEncoding
in interfaceEnvironment
- Returns:
- encoding used in the project
-
getEncodingProvider
Description copied from interface:Environment
Get encoding provider, which is used to detect encoding for each file separately- Specified by:
getEncodingProvider
in interfaceEnvironment
- Returns:
- the current encoding provider
-
setEncoding
Description copied from interface:Environment
Set the encoding to use for parsing source code- Specified by:
setEncoding
in interfaceEnvironment
- Parameters:
encoding
- the character set to use for source file encoding
-
setEncodingProvider
Description copied from interface:Environment
Set encoding provider, which is used to detect encoding for each file separately- Specified by:
setEncodingProvider
in interfaceEnvironment
- Parameters:
encodingProvider
- the encoding provider to set
-
setOutputType
Description copied from interface:Environment
Set the output type used for processing files- Specified by:
setOutputType
in interfaceEnvironment
- Parameters:
outputType
- output type to use when pretty-printing
-
getOutputType
Description copied from interface:Environment
Get the output type- Specified by:
getOutputType
in interfaceEnvironment
- Returns:
- the current output type
-
getSpoonProgress
Description copied from interface:Environment
Get the spoonProgress logger. This method mustn't return null.- Specified by:
getSpoonProgress
in interfaceEnvironment
- Returns:
- the spoonProgress
-
setSpoonProgress
- Specified by:
setSpoonProgress
in interfaceEnvironment
-
getCompressionType
Description copied from interface:Environment
Get the type of serialization to be used by default- Specified by:
getCompressionType
in interfaceEnvironment
- Returns:
- the current type of serialization
-
setCompressionType
Description copied from interface:Environment
Set the type of serialization to be used by default- Specified by:
setCompressionType
in interfaceEnvironment
- Parameters:
serializationType
- the type of serialization to set
-
createPrettyPrinterAutoImport
Description copied from interface:Environment
Creates 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)
totrue
and then invokinEnvironment.createPrettyPrinter()
, except that the environment is not modified.- Specified by:
createPrettyPrinterAutoImport
in interfaceEnvironment
- Returns:
- new instance of
PrettyPrinter
which prints nice code
-
createPrettyPrinter
Description copied from interface:Environment
Creates the default pretty-printer.- Specified by:
createPrettyPrinter
in interfaceEnvironment
- Returns:
- new instance of
PrettyPrinter
which is configured for this environment
-
setPrettyPrinterCreator
Description copied from interface:Environment
Sets a custom pretty-printer that overrides the default pretty-printer. Can for example be used to create aSniperJavaPrettyPrinter
for enabling the sniper mode.env.setPrettyPrinterCreator(() -> new SniperJavaPrettyPrinter(env));
- Specified by:
setPrettyPrinterCreator
in interfaceEnvironment
- Parameters:
creator
- aSupplier
, which creates new instance of pretty printer.
-
useLegacyTypeAdaption
public boolean useLegacyTypeAdaption()Description copied from interface:Environment
Whether to use the new or legacy and (soon to be) deprecated type adaption. You should not use this method.- Specified by:
useLegacyTypeAdaption
in 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:Environment
Sets whether to use the new or legacy and (soon to be) deprecated type adaption. You should not use this method.- Specified by:
setUseLegacyTypeAdaption
in interfaceEnvironment
- Parameters:
useLegacyTypeAdaption
- whether to use the old type adaption implementation
-
isIgnoreDuplicateDeclarations
public boolean isIgnoreDuplicateDeclarations()Description copied from interface:Environment
Whether Spoon currently ignores duplicate declarations of types.- Specified by:
isIgnoreDuplicateDeclarations
in 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:Environment
Set Spoon to ignore duplicate type declarations in a project. Setting this option totrue
causes 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:
setIgnoreDuplicateDeclarations
in 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
-