Repository navigation
Shorten fully qualified type names to simple names with imports - #94
Merged
Merged
Conversation
|
I have read the CLA Document and I hereby sign the CLA Tom Tourwe seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces type names written out in full in the code by their simple name plus an import, for example
java.util.List<String> list = new java.util.ArrayList<>()becomesList<String> list = new ArrayList<>()with
import java.util.ArrayList;andimport java.util.List;. The change is mechanical, made with an automatedimport refactoring.
The two commits
da48dee3): unused imports are removed, and import blocks that were in no consistent order aresorted. No code line changes.
cbed5c20): a type name written in full becomes its simple name and the import isadded. A nested type keeps its enclosing type (
java.util.Map.EntrybecomesMap.Entry, importingjava.util.Map); a static member keeps its class (java.util.Collections.emptyList()becomesCollections.emptyList()); no static import is added. Comments, javadoc and string literals are left as they are.A name stays qualified where its simple name would mean another type in that file: another type of that simple
name is imported, declared or written in the file, or two on-demand imports would both provide it.
Verification
./gradlew testpasses, with no failures.Where qualified names are kept
Each link points to a line where a type name is still written in full, because its simple name already means another
type in that file (for example
org.slf4j.Loggerbeside an import ofch.qos.logback.classic.Logger).maddi-aapi-parser: CommonTest.java, line 71 writesorg.slf4j.Loggerin fullmaddi-aapi-parser: CompileAnalysisHints.java, line 123 writesch.qos.logback.classic.Loggerin fullmaddi-aapi-parser: ComposeAnalysisHints.java, line 87 writesch.qos.logback.classic.Loggerin fullmaddi-aapi-parser: TestAnalysisHintsCompiler.java, line 74 writesch.qos.logback.classic.Loggerin fullmaddi-aapi-parser: TestAnalysisHintsComposer.java, line 60 writesch.qos.logback.classic.Loggerin fullmaddi-aapi-parser: TestAnalysisHintsParser.java, line 50 writesorg.slf4j.Loggerin fullmaddi-aapi-parser: TestParseAnalyzeWrite.java, line 69 writesorg.slf4j.Loggerin fullmaddi-modification-analyzer: CommonTest.java, line 67 writesorg.slf4j.Loggerin fullmaddi-modification-analyzer: SingleIterationAnalyzerImpl.java, line 148 writesjava.lang.Runtimein fullmaddi-modification-analyzer: TestCloneBench.java, line 118 writesio.codelaser.maddi.modification.common.CommonTestin fullmaddi-modification-analyzer: TestShadowCloneBench.java, line 88 writesio.codelaser.maddi.modification.common.CommonTestin fullmaddi-modification-common: CommonIsolateMethodTest.java, line 25 writesorg.slf4j.Loggerin fullmaddi-modification-common: TestIsolateClass1.java, line 35 writesorg.slf4j.Loggerin fullmaddi-modification-common: TestIsolateClass2.java, line 39 writesorg.slf4j.Loggerin fullmaddi-modification-common: TestIsolateClass3SelfReference.java, line 41 writesorg.slf4j.Loggerin fullmaddi-modification-common: TestIsolateClass4Compiles.java, line 59 writesorg.slf4j.Loggerin fullmaddi-modification-common: TestIsolateClass5Group.java, line 48 writesorg.slf4j.Loggerin fullmaddi-modification-common: TestIsolateClass6FreshFactories.java, line 55 writesorg.slf4j.Loggerin fullmaddi-modification-common: TestIsolateClass7InheritedMembers.java, line 53 writesorg.slf4j.Loggerin fullmaddi-modification-common: TestIsolateClass8Natures.java, line 40 writesorg.slf4j.Loggerin fullmaddi-modification-link: CommonTest.java, line 29 writesorg.slf4j.Loggerin fullmaddi-modification-link: TestLoadAnalyzedPackageFiles.java, line 51 writesorg.slf4j.Loggerin fullmaddi-modification-prepwork: CommonTest.java, line 49 writesorg.slf4j.Loggerin fullmaddi-modification-prepwork: MethodAnalyzer.java, line 1025 writesio.codelaser.maddi.cst.api.element.Visitorin fullmaddi-run-analysis: TestActiveMQBroker.java, line 28 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestCorpusSweep.java, line 33 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestElasticsearchServer.java, line 74 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestFernflower.java, line 26 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestFernflowerNullabilityCauses.java, line 56 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestGuava.java, line 31 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestIsolateFernflowerGroup.java, line 47 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestJavaToCSharpFernflowerFacts.java, line 27 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestJavaToCSharpLangchain4jFacts.java, line 27 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestJavaToCSharpTimefoldFacts.java, line 30 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestJavaToKotlinAblation.java, line 36 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestJavaToKotlinFernflowerNullability.java, line 31 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestJavaToKotlinGuavaNullability.java, line 29 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestJavaToKotlinJenkinsNullability.java, line 25 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestJavaToKotlinLangchain4jNullability.java, line 29 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestJavaToKotlinNacosNullability.java, line 26 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestJavaToKotlinPreconditions.java, line 33 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestJavaToKotlinTimefoldNullability.java, line 25 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestJenkinsCore.java, line 28 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestKotlinConfReproduce.java, line 29 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestLangchain4j.java, line 22 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestLangchain4jCollections.java, line 64 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestLibraryCallCensus.java, line 59 writesorg.slf4j.Loggerin fullmaddi-run-analysis: TestNullabilityOracleGuava.java, line 79 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestParSeqLinkBench.java, line 44 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestRewireFernflower.java, line 58 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestRunAnalyzer.java, line 40 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestRunAnalyzer.java, line 41 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestRunComposer.java, line 38 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestRunComposer.java, line 38 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestRunShallowAnalyzer.java, line 40 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestRunShallowAnalyzer.java, line 41 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: TestTimefoldSolver.java, line 27 writesch.qos.logback.classic.Loggerin fullmaddi-run-analysis: module-info.java, line 14 writesprovides io.codelaser.maddi.analysis.api.AnalysisEngine with io.codelaser.maddi.run.analysis.AnalysisEngineImpl;, which stays as it ismaddi-run-kotlin-analysis: TestOneEntryPointAnalysis.java, line 65 writesio.codelaser.maddi.run.openjdkmain.Mainin full