├── nondex-common ├── .gitignore ├── checkstyle.xml ├── src │ └── main │ │ └── java │ │ └── edu │ │ └── illinois │ │ └── nondex │ │ └── common │ │ ├── project.properties │ │ ├── Mode.java │ │ ├── Level.java │ │ ├── Logger.java │ │ └── Utils.java └── pom.xml ├── nondex-maven-plugin ├── .gitignore ├── checkstyle.xml └── src │ ├── it │ ├── comprehensive │ │ ├── src │ │ │ └── test │ │ ├── verify.groovy │ │ └── pom.xml │ ├── failing-it │ │ ├── invoker.properties │ │ ├── verify.groovy │ │ ├── src │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── edu │ │ │ │ └── illinois │ │ │ │ └── nondex │ │ │ │ └── it │ │ │ │ └── AppTest.java │ │ └── pom.xml │ ├── simple-it │ │ ├── invoker.properties │ │ ├── verify.groovy │ │ ├── pom.xml │ │ └── src │ │ │ └── test │ │ │ └── java │ │ │ └── edu │ │ │ └── illinois │ │ │ └── nondex │ │ │ └── it │ │ │ └── AppTest.java │ ├── clean-it │ │ ├── invoker.properties │ │ ├── verify.groovy │ │ ├── src │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── edu │ │ │ │ └── illinois │ │ │ │ └── nondex │ │ │ │ └── it │ │ │ │ └── AppTest.java │ │ └── pom.xml │ ├── simple-multimodule-it │ │ ├── invoker.properties │ │ ├── verify.groovy │ │ ├── module1 │ │ │ ├── src │ │ │ │ └── test │ │ │ │ │ └── java │ │ │ │ │ └── edu │ │ │ │ │ └── illinois │ │ │ │ │ └── nondex │ │ │ │ │ └── it │ │ │ │ │ └── SimpleTest.java │ │ │ └── pom.xml │ │ ├── module2 │ │ │ ├── src │ │ │ │ └── test │ │ │ │ │ └── java │ │ │ │ │ └── edu │ │ │ │ │ └── illinois │ │ │ │ │ └── nondex │ │ │ │ │ └── it │ │ │ │ │ └── SimpleTest.java │ │ │ └── pom.xml │ │ └── pom.xml │ ├── excluded-groups-it │ │ ├── invoker.properties │ │ ├── verify.groovy │ │ ├── module1 │ │ │ ├── src │ │ │ │ └── test │ │ │ │ │ └── java │ │ │ │ │ └── edu │ │ │ │ │ └── illinois │ │ │ │ │ └── nondex │ │ │ │ │ └── it │ │ │ │ │ ├── Module1Ignore.java │ │ │ │ │ └── ExcludedGroupsTest.java │ │ │ └── pom.xml │ │ ├── module2 │ │ │ ├── src │ │ │ │ └── test │ │ │ │ │ └── java │ │ │ │ │ └── edu │ │ │ │ │ └── illinois │ │ │ │ │ └── nondex │ │ │ │ │ └── it │ │ │ │ │ └── ExcludedGroupsTest.java │ │ │ └── pom.xml │ │ └── pom.xml │ ├── inexistent-variable-argline-it │ │ ├── invoker.properties │ │ ├── verify.groovy │ │ ├── src │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── edu │ │ │ │ └── illinois │ │ │ │ └── nondex │ │ │ │ └── it │ │ │ │ ├── SimpleTest.java │ │ │ │ └── AppTest.java │ │ └── pom.xml │ ├── clean-it with-whitespace-in-path │ │ ├── invoker.properties │ │ ├── verify.groovy │ │ ├── src │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── edu │ │ │ │ └── illinois │ │ │ │ └── nondex │ │ │ │ └── it │ │ │ │ └── AppTest.java │ │ └── pom.xml │ ├── settings-property-argline-it │ │ ├── invoker.properties │ │ ├── verify.groovy │ │ ├── src │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── edu │ │ │ │ └── illinois │ │ │ │ └── nondex │ │ │ │ └── it │ │ │ │ └── SettingsArgLineTest.java │ │ └── pom.xml │ ├── multiple-surefire-executions │ │ ├── verify.groovy │ │ ├── src │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── edu │ │ │ │ └── illinois │ │ │ │ └── nondex │ │ │ │ └── it │ │ │ │ ├── AppExec1Test.java │ │ │ │ └── AppExec2Test.java │ │ └── pom.xml │ └── settings.xml │ ├── main │ └── java │ │ └── edu │ │ └── illinois │ │ └── nondex │ │ └── plugin │ │ ├── Failure.java │ │ └── CleanMojo.java │ └── test │ └── java │ └── edu │ └── illinois │ └── nondex │ └── plugin │ └── CleanSurefireExecutionTest.java ├── nondex-instrumentation ├── checkstyle.xml ├── resources │ ├── empty.jar │ └── META-INF │ │ └── MANIFEST.MF └── src │ ├── main │ └── java │ │ └── edu │ │ └── illinois │ │ └── nondex │ │ └── instr │ │ ├── Main.java │ │ ├── CVFactory.java │ │ └── ConcurrentHashMapShufflingAdder.java │ └── test │ └── java │ └── edu │ └── illinois │ └── nondex │ └── instr │ └── InstrumenterTest.java ├── nondex-gradle-plugin ├── plugin │ ├── src │ │ ├── functionalTest │ │ │ └── resources │ │ │ │ ├── excluded-tests-it │ │ │ │ ├── module2 │ │ │ │ │ ├── build.gradle │ │ │ │ │ └── src │ │ │ │ │ │ └── test │ │ │ │ │ │ └── java │ │ │ │ │ │ └── edu │ │ │ │ │ │ └── illinois │ │ │ │ │ │ └── nondex │ │ │ │ │ │ └── functionalTest │ │ │ │ │ │ └── SimpleTest.java │ │ │ │ ├── settings.gradle │ │ │ │ ├── module1 │ │ │ │ │ ├── build.gradle │ │ │ │ │ └── src │ │ │ │ │ │ └── test │ │ │ │ │ │ └── java │ │ │ │ │ │ └── edu │ │ │ │ │ │ └── illinois │ │ │ │ │ │ └── nondex │ │ │ │ │ │ └── functionalTest │ │ │ │ │ │ └── ExcludedTest.java │ │ │ │ └── build.gradle │ │ │ │ ├── simple-multimodule-it │ │ │ │ ├── module1 │ │ │ │ │ ├── build.gradle │ │ │ │ │ └── src │ │ │ │ │ │ └── test │ │ │ │ │ │ └── java │ │ │ │ │ │ └── edu │ │ │ │ │ │ └── illinois │ │ │ │ │ │ └── nondex │ │ │ │ │ │ └── functionalTest │ │ │ │ │ │ └── SimpleTest.java │ │ │ │ ├── module2 │ │ │ │ │ ├── build.gradle │ │ │ │ │ └── src │ │ │ │ │ │ └── test │ │ │ │ │ │ └── java │ │ │ │ │ │ └── edu │ │ │ │ │ │ └── illinois │ │ │ │ │ │ └── nondex │ │ │ │ │ │ └── functionalTest │ │ │ │ │ │ └── SimpleTest.java │ │ │ │ ├── settings.gradle │ │ │ │ └── build.gradle │ │ │ │ ├── clean-it │ │ │ │ ├── settings.gradle │ │ │ │ ├── build.gradle │ │ │ │ └── src │ │ │ │ │ └── test │ │ │ │ │ └── java │ │ │ │ │ └── edu │ │ │ │ │ └── illinois │ │ │ │ │ └── nondex │ │ │ │ │ └── functionalTest │ │ │ │ │ └── AppTest.java │ │ │ │ ├── simple-it │ │ │ │ ├── settings.gradle │ │ │ │ ├── build.gradle │ │ │ │ └── src │ │ │ │ │ └── test │ │ │ │ │ └── java │ │ │ │ │ └── edu │ │ │ │ │ └── illinois │ │ │ │ │ └── nondex │ │ │ │ │ └── functionalTest │ │ │ │ │ └── AppTest.java │ │ │ │ ├── argline-it │ │ │ │ ├── settings.gradle │ │ │ │ ├── build.gradle │ │ │ │ └── src │ │ │ │ │ └── test │ │ │ │ │ └── java │ │ │ │ │ └── edu │ │ │ │ │ └── illinois │ │ │ │ │ └── nondex │ │ │ │ │ └── functionalTest │ │ │ │ │ ├── AppTest.java │ │ │ │ │ └── SimpleTest.java │ │ │ │ ├── failing-it │ │ │ │ ├── settings.gradle │ │ │ │ ├── build.gradle │ │ │ │ └── src │ │ │ │ │ └── test │ │ │ │ │ └── java │ │ │ │ │ └── edu │ │ │ │ │ └── illinois │ │ │ │ │ └── nondex │ │ │ │ │ └── functionalTest │ │ │ │ │ └── AppTest.java │ │ │ │ ├── comprehensive-it │ │ │ │ ├── settings.gradle │ │ │ │ ├── src │ │ │ │ │ └── test │ │ │ │ │ │ └── java │ │ │ │ │ │ └── edu │ │ │ │ │ │ └── illinois │ │ │ │ │ │ └── nondex │ │ │ │ │ │ └── functionalTest │ │ │ │ │ │ ├── TestAnnotation1.java │ │ │ │ │ │ ├── TestAnnotation2.java │ │ │ │ │ │ ├── TestAnnotation3.java │ │ │ │ │ │ ├── TestAnnotation4.java │ │ │ │ │ │ ├── TestAnnotation5.java │ │ │ │ │ │ ├── TestAnnotation6.java │ │ │ │ │ │ ├── TestAnnotation7.java │ │ │ │ │ │ ├── TestAnnotation8.java │ │ │ │ │ │ ├── CollatorTest.java │ │ │ │ │ │ ├── DateFormatTest.java │ │ │ │ │ │ ├── BreakIteratorTest.java │ │ │ │ │ │ ├── DecimalFormatSymbolsTest.java │ │ │ │ │ │ ├── FileTest.java │ │ │ │ │ │ ├── FieldTest.java │ │ │ │ │ │ ├── DateFormatSymbolsTest.java │ │ │ │ │ │ ├── MethodTest.java │ │ │ │ │ │ ├── AbstractCollectionTest.java │ │ │ │ │ │ ├── HashSetTest.java │ │ │ │ │ │ ├── ClassTest.java │ │ │ │ │ │ ├── ClassTestHelper.java │ │ │ │ │ │ ├── DelayQueueTest.java │ │ │ │ │ │ ├── QueueTest.java │ │ │ │ │ │ └── MapTest.java │ │ │ │ └── build.gradle │ │ │ │ └── clean-it with-whitespace-in-path │ │ │ │ ├── settings.gradle │ │ │ │ ├── build.gradle │ │ │ │ └── src │ │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── edu │ │ │ │ └── illinois │ │ │ │ └── nondex │ │ │ │ └── functionalTest │ │ │ │ └── AppTest.java │ │ ├── main │ │ │ └── java │ │ │ │ └── edu │ │ │ │ └── illinois │ │ │ │ └── nondex │ │ │ │ └── gradle │ │ │ │ ├── constants │ │ │ │ └── NonDexGradlePluginConstants.java │ │ │ │ ├── internal │ │ │ │ ├── DebugExecuter.java │ │ │ │ └── NonDexTestProcessor.java │ │ │ │ ├── tasks │ │ │ │ ├── NonDexClean.java │ │ │ │ └── NonDexTest.java │ │ │ │ ├── plugin │ │ │ │ └── NonDexGradlePlugin.java │ │ │ │ └── util │ │ │ │ └── MavenChecksumFetcher.java │ │ └── test │ │ │ └── java │ │ │ └── edu │ │ │ └── illinois │ │ │ └── nondex │ │ │ └── gradle │ │ │ └── plugin │ │ │ └── NonDexGradlePluginTest.java │ └── build.gradle ├── settings.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties └── gradlew.bat ├── docs └── images │ ├── debugbutton.png │ ├── remotejvmdebug.png │ ├── debugconfigurationbutton.png │ └── toolbarconfigurationbutton.png ├── .codeclimate.yml ├── nondex-core ├── LICENSE ├── pom.xml └── src │ └── main │ └── java │ └── java │ └── util │ └── HashIteratorShuffler.java ├── .travis.yml ├── LICENSE ├── nondex-annotations ├── src │ └── main │ │ └── java │ │ └── edu │ │ └── illinois │ │ └── NonDexIgnore.java └── pom.xml ├── .gitignore ├── appveyor.yml ├── nondex-test └── src │ └── test │ └── java │ └── edu │ └── illinois │ └── nondex │ └── core │ ├── TestAnnotation1.java │ ├── TestAnnotation2.java │ ├── TestAnnotation3.java │ ├── TestAnnotation4.java │ ├── TestAnnotation5.java │ ├── TestAnnotation6.java │ ├── TestAnnotation7.java │ ├── TestAnnotation8.java │ ├── CollatorTest.java │ ├── DateFormatTest.java │ ├── BreakIteratorTest.java │ ├── DecimalFormatSymbolsTest.java │ ├── FileTest.java │ ├── IdentityHashMapTest.java │ ├── FieldTest.java │ ├── DateFormatSymbolsTest.java │ ├── MethodTest.java │ ├── AbstractCollectionTest.java │ ├── HashSetTest.java │ ├── ClassTest.java │ ├── ClassTestHelper.java │ └── DelayQueueTest.java ├── .github └── workflows │ └── ci.yml └── modify-gradle-build └── add-nondex.sh /nondex-common/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /nondex-maven-plugin/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /nondex-common/checkstyle.xml: -------------------------------------------------------------------------------- 1 | ../checkstyle.xml -------------------------------------------------------------------------------- /nondex-maven-plugin/checkstyle.xml: -------------------------------------------------------------------------------- 1 | ../checkstyle.xml -------------------------------------------------------------------------------- /nondex-instrumentation/checkstyle.xml: -------------------------------------------------------------------------------- 1 | ../checkstyle.xml -------------------------------------------------------------------------------- /nondex-instrumentation/resources/empty.jar: -------------------------------------------------------------------------------- 1 | PK -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/comprehensive/src/test: -------------------------------------------------------------------------------- 1 | ../../../../../nondex-test/src/test -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/failing-it/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.buildResult = failure -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/simple-it/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.buildResult = failure -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/excluded-tests-it/module2/build.gradle: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/clean-it/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.goals = nondex:nondex nondex:clean -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/simple-multimodule-it/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.goals = nondex:nondex -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/simple-multimodule-it/module1/build.gradle: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/simple-multimodule-it/module2/build.gradle: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nondex-common/src/main/java/edu/illinois/nondex/common/project.properties: -------------------------------------------------------------------------------- 1 | version=${project.version} 2 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'nondex-gradle-plugin' 2 | include('plugin') 3 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/excluded-groups-it/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.goals = nondex:nondex nondex:clean -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/clean-it/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'clean-it' 2 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/simple-it/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'simple-it' 2 | -------------------------------------------------------------------------------- /docs/images/debugbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TestingResearchIllinois/NonDex/HEAD/docs/images/debugbutton.png -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/argline-it/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'argline-it' 2 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/failing-it/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'failing-it' 2 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/inexistent-variable-argline-it/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.goals = nondex:nondex nondex:clean 2 | -------------------------------------------------------------------------------- /docs/images/remotejvmdebug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TestingResearchIllinois/NonDex/HEAD/docs/images/remotejvmdebug.png -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/clean-it with-whitespace-in-path/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.goals = nondex:nondex nondex:clean 2 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'comprehensive-it' 2 | -------------------------------------------------------------------------------- /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | engines: 2 | fixme: 3 | enabled: true 4 | ratings: 5 | paths: [] 6 | exclude_paths: 7 | - nondex-core/src/main/**/* 8 | -------------------------------------------------------------------------------- /docs/images/debugconfigurationbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TestingResearchIllinois/NonDex/HEAD/docs/images/debugconfigurationbutton.png -------------------------------------------------------------------------------- /docs/images/toolbarconfigurationbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TestingResearchIllinois/NonDex/HEAD/docs/images/toolbarconfigurationbutton.png -------------------------------------------------------------------------------- /nondex-core/LICENSE: -------------------------------------------------------------------------------- 1 | The java code in this directory is distributed under Oracle's original 2 | License (GPL v2). Please see the license on the files. 3 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/clean-it with-whitespace-in-path/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'clean-it with-whitespace-in-path' 2 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/excluded-tests-it/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'excluded-tests-it' 2 | 3 | include 'module1', 'module2' -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/clean-it/verify.groovy: -------------------------------------------------------------------------------- 1 | File nondexDirectory = new File( basedir, ".nondex" ); 2 | 3 | sleep(3000) 4 | assert ! nondexDirectory.exists(); 5 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/settings-property-argline-it/invoker.properties: -------------------------------------------------------------------------------- 1 | # Only run this IT on Java 11 and above (due to mockito verison 5) 2 | invoker.java.version = 11+ -------------------------------------------------------------------------------- /nondex-gradle-plugin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TestingResearchIllinois/NonDex/HEAD/nondex-gradle-plugin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/simple-multimodule-it/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'simple-multimodule-it' 2 | 3 | include 'module1', 'module2' -------------------------------------------------------------------------------- /nondex-instrumentation/resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Created-By: 1.6.0_06 (Sun Microsystems Inc.) 3 | Main-Class: edu.illinois.nondex.instr.Main 4 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/excluded-groups-it/verify.groovy: -------------------------------------------------------------------------------- 1 | File nondexDirectory = new File( basedir, ".nondex" ); 2 | 3 | sleep(3000) 4 | assert ! nondexDirectory.exists(); 5 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/excluded-groups-it/module1/src/test/java/edu/illinois/nondex/it/Module1Ignore.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.it; 2 | 3 | public interface Module1Ignore {} -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/clean-it with-whitespace-in-path/verify.groovy: -------------------------------------------------------------------------------- 1 | File nondexDirectory = new File( basedir, ".nondex" ); 2 | 3 | sleep(3000) 4 | assert ! nondexDirectory.exists(); 5 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/inexistent-variable-argline-it/verify.groovy: -------------------------------------------------------------------------------- 1 | File nondexDirectory = new File( basedir, ".nondex" ); 2 | 3 | sleep(3000) 4 | assert ! nondexDirectory.exists(); 5 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/simple-it/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'edu.illinois.nondex' 4 | } 5 | 6 | repositories { 7 | mavenCentral() 8 | } 9 | 10 | dependencies { 11 | testImplementation 'junit:junit:4.13.2' 12 | } -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/simple-multimodule-it/verify.groovy: -------------------------------------------------------------------------------- 1 | File nondexDirectory = new File( basedir, "module1/.nondex" ); 2 | 3 | sleep(3000) 4 | assert nondexDirectory.exists(); 5 | 6 | nondexDirectory = new File( basedir, "module2/.nondex" ); 7 | assert nondexDirectory.exists(); -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/clean-it/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'edu.illinois.nondex' 4 | } 5 | 6 | repositories { 7 | mavenCentral() 8 | } 9 | 10 | dependencies { 11 | testImplementation 'junit:junit:4.13.2' 12 | } 13 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/failing-it/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'edu.illinois.nondex' 4 | } 5 | 6 | repositories { 7 | mavenCentral() 8 | } 9 | 10 | dependencies { 11 | testImplementation 'junit:junit:4.13.2' 12 | } -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/failing-it/verify.groovy: -------------------------------------------------------------------------------- 1 | File nondexDirectory = new File( basedir, ".nondex" ); 2 | 3 | sleep(3000) 4 | assert nondexDirectory.isDirectory(); 5 | 6 | // Every run adds 5 directories. Latest and jar are static 7 | assert (nondexDirectory.list().length - 2) % 5 == 0; 8 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/simple-it/verify.groovy: -------------------------------------------------------------------------------- 1 | File nondexDirectory = new File( basedir, ".nondex" ); 2 | 3 | sleep(3000) 4 | assert nondexDirectory.isDirectory(); 5 | 6 | // Every run adds 5 directories. Latest and jar are static 7 | assert (nondexDirectory.list().length - 2) % 5 == 0; 8 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/clean-it with-whitespace-in-path/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'edu.illinois.nondex' 4 | } 5 | 6 | repositories { 7 | mavenCentral() 8 | } 9 | 10 | dependencies { 11 | testImplementation 'junit:junit:4.13.2' 12 | } 13 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/multiple-surefire-executions/verify.groovy: -------------------------------------------------------------------------------- 1 | File nondexDirectory = new File( basedir, ".nondex" ); 2 | 3 | sleep(3000) 4 | assert nondexDirectory.isDirectory(); 5 | 6 | // 3 execution adds 12 directories (1 clean / 3 shuffled). 3 other overhead files 7 | assert (nondexDirectory.list().length - 3) == 12; 8 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/excluded-tests-it/module1/build.gradle: -------------------------------------------------------------------------------- 1 | tasks.withType(Test) { 2 | filter { 3 | excludeTestsMatching 'ExcludedTest.testModuleExclude' 4 | } 5 | } 6 | 7 | nondexTest { 8 | filter { 9 | excludeTestsMatching 'ExcludedTest.testNonDexExclude' 10 | } 11 | } -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: xenial 2 | osx_image: xcode9.3 3 | 4 | language: java 5 | 6 | os: 7 | - linux 8 | - osx 9 | 10 | jdk: 11 | - openjdk8 12 | 13 | env: 14 | - CMD="mvn verify -B" 15 | - CMD="cd nondex-gradle-plugin; ./gradlew check"; 16 | 17 | matrix: 18 | allow_failures: 19 | - os: osx 20 | 21 | script: eval $CMD 22 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/TestAnnotation1.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | @Retention(RetentionPolicy.RUNTIME) 7 | public @interface TestAnnotation1 {} 8 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/TestAnnotation2.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | @Retention(RetentionPolicy.RUNTIME) 7 | public @interface TestAnnotation2 { 8 | } 9 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/TestAnnotation3.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | @Retention(RetentionPolicy.RUNTIME) 7 | public @interface TestAnnotation3 { 8 | } 9 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/TestAnnotation4.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | @Retention(RetentionPolicy.RUNTIME) 7 | public @interface TestAnnotation4 { 8 | } 9 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/TestAnnotation5.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | @Retention(RetentionPolicy.RUNTIME) 7 | public @interface TestAnnotation5 { 8 | } 9 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/TestAnnotation6.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | @Retention(RetentionPolicy.RUNTIME) 7 | public @interface TestAnnotation6 { 8 | } 9 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/TestAnnotation7.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | @Retention(RetentionPolicy.RUNTIME) 7 | public @interface TestAnnotation7 { 8 | } 9 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/TestAnnotation8.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | @Retention(RetentionPolicy.RUNTIME) 7 | public @interface TestAnnotation8 { 8 | } 9 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/clean-it/src/test/java/edu/illinois/nondex/functionalTest/AppTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertTrue; 6 | 7 | public class AppTest { 8 | @Test 9 | public void testHashSet() { 10 | assertTrue(true); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/argline-it/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'edu.illinois.nondex' 4 | } 5 | 6 | repositories { 7 | mavenCentral() 8 | } 9 | 10 | dependencies { 11 | testImplementation 'junit:junit:4.13.2' 12 | } 13 | 14 | tasks.withType(Test) { 15 | jvmArgs += ['-DmyArgumentForTesting=1219', '-DthroughProperty=3423'] 16 | } -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/argline-it/src/test/java/edu/illinois/nondex/functionalTest/AppTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertTrue; 6 | 7 | public class AppTest { 8 | 9 | @Test 10 | public void testExecuted() { 11 | assertTrue(true); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/excluded-tests-it/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'edu.illinois.nondex' 3 | } 4 | 5 | allprojects { 6 | 7 | apply plugin: 'java' 8 | apply plugin: 'edu.illinois.nondex' 9 | 10 | repositories { 11 | mavenCentral() 12 | } 13 | 14 | dependencies { 15 | testImplementation 'junit:junit:4.13.2' 16 | } 17 | } -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/failing-it/src/test/java/edu/illinois/nondex/functionalTest/AppTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertTrue; 6 | 7 | public class AppTest { 8 | 9 | @Test 10 | public void testHashSet() { 11 | assertTrue(false); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/clean-it with-whitespace-in-path/src/test/java/edu/illinois/nondex/functionalTest/AppTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.fuctionalTest; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertTrue; 6 | 7 | public class AppTest 8 | { 9 | @Test 10 | public void testHashSet() { 11 | assertTrue(true); 12 | } 13 | } -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'edu.illinois.nondex' 4 | } 5 | 6 | repositories { 7 | mavenCentral() 8 | } 9 | 10 | dependencies { 11 | testImplementation 'junit:junit:4.13.2' 12 | testImplementation 'edu.illinois:nondex-common:2.2.1' 13 | testImplementation 'org.hamcrest:hamcrest:2.2' 14 | } 15 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/excluded-tests-it/module2/src/test/java/edu/illinois/nondex/functionalTest/SimpleTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertFalse; 6 | 7 | public class SimpleTest { 8 | 9 | @Test 10 | public void testHashSet() { 11 | assertFalse(false); 12 | } 13 | } -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/simple-multimodule-it/module1/src/test/java/edu/illinois/nondex/it/SimpleTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.it; 2 | 3 | import org.junit.Test; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class SimpleTest { 7 | 8 | @Test 9 | public void testSimple() { 10 | String varValue = System.getProperty("myArgumentForTesting"); 11 | assertEquals("1219", varValue); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/simple-multimodule-it/module2/src/test/java/edu/illinois/nondex/it/SimpleTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.it; 2 | 3 | import org.junit.Test; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class SimpleTest { 7 | 8 | @Test 9 | public void testSimple() { 10 | String varValue = System.getProperty("myArgumentForTesting"); 11 | assertEquals("1219", varValue); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/simple-multimodule-it/module1/src/test/java/edu/illinois/nondex/functionalTest/SimpleTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | 7 | public class SimpleTest { 8 | 9 | @Test 10 | public void testSimple() { 11 | String varValue = System.getProperty("myArgumentForTesting"); 12 | assertEquals("1219", varValue); 13 | } 14 | } -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/simple-multimodule-it/module2/src/test/java/edu/illinois/nondex/functionalTest/SimpleTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | 7 | public class SimpleTest { 8 | 9 | @Test 10 | public void testSimple() { 11 | String varValue = System.getProperty("myArgumentForTesting"); 12 | assertEquals("1219", varValue); 13 | } 14 | } -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/simple-multimodule-it/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'edu.illinois.nondex' 3 | } 4 | 5 | allprojects { 6 | 7 | apply plugin: 'java' 8 | apply plugin: 'edu.illinois.nondex' 9 | 10 | repositories { 11 | mavenCentral() 12 | } 13 | 14 | dependencies { 15 | testImplementation 'junit:junit:4.13.2' 16 | } 17 | 18 | tasks.withType(Test) { 19 | jvmArgs += '-DmyArgumentForTesting=1219' 20 | } 21 | } -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/settings-property-argline-it/verify.groovy: -------------------------------------------------------------------------------- 1 | File nondexDirectory = new File(basedir, ".nondex"); 2 | sleep(3000); 3 | assert nondexDirectory.isDirectory() : "NonDex directory should exist"; 4 | 5 | // Verify that nondex ran successfully with the settings property in argLine 6 | // Should have 1 clean execution + 3 shuffled = 4 directories, plus 3 overhead files 7 | assert (nondexDirectory.list().length - 3) == 4; 8 | 9 | // If the settings property was removed the build would have failed before getting here -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/main/java/edu/illinois/nondex/gradle/constants/NonDexGradlePluginConstants.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.gradle.constants; 2 | 3 | import edu.illinois.nondex.gradle.util.MavenChecksumFetcher; 4 | 5 | public abstract class NonDexGradlePluginConstants { 6 | 7 | public static final String NONDEX_VERSION = "2.2.1"; 8 | public static final String NONDEX_COMMON_SHA1 = MavenChecksumFetcher.getSHA1( 9 | "edu.illinois", 10 | "nondex-common", 11 | NONDEX_VERSION 12 | ); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/inexistent-variable-argline-it/src/test/java/edu/illinois/nondex/it/SimpleTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.it; 2 | 3 | import org.junit.Test; 4 | import static org.junit.Assert.assertEquals; 5 | 6 | public class SimpleTest { 7 | 8 | @Test 9 | public void testSimple() { 10 | String varValue = System.getProperty("myArgumentForTesting"); 11 | assertEquals("1219", varValue); 12 | varValue = System.getProperty("throughProperty"); 13 | assertEquals("3423", varValue); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/excluded-groups-it/module2/src/test/java/edu/illinois/nondex/it/ExcludedGroupsTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.it; 2 | 3 | import org.junit.Test; 4 | import org.junit.experimental.categories.Category; 5 | import static org.junit.Assert.assertTrue; 6 | import static org.junit.Assert.assertFalse; 7 | import java.util.HashSet; 8 | 9 | public class ExcludedGroupsTest { 10 | 11 | @Test 12 | @Category(edu.illinois.NonDexIgnore.class) 13 | public void testNonDexIgnore() { 14 | assertFalse(true); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/argline-it/src/test/java/edu/illinois/nondex/functionalTest/SimpleTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | 7 | public class SimpleTest { 8 | 9 | @Test 10 | public void testSimple() { 11 | String varValue = System.getProperty("myArgumentForTesting"); 12 | assertEquals("1219", varValue); 13 | varValue = System.getProperty("throughProperty"); 14 | assertEquals("3423", varValue); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/excluded-groups-it/module2/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | excluded-groups-it 7 | nondex.plugin.it 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | module2 12 | 13 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/simple-multimodule-it/module1/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | excluded-groups-it 7 | nondex.plugin.it 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | module1 12 | 13 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/simple-multimodule-it/module2/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | excluded-groups-it 7 | nondex.plugin.it 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | module2 12 | 13 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/CollatorTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import static org.hamcrest.core.IsEqual.equalTo; 4 | import static org.hamcrest.core.IsNot.not; 5 | import static org.junit.Assert.assertThat; 6 | 7 | import java.text.Collator; 8 | 9 | import org.junit.Test; 10 | 11 | public class CollatorTest { 12 | @Test 13 | public void getAvailableLocalesTest() { 14 | assertThat(Collator.getAvailableLocales(), not(equalTo(Collator.getAvailableLocales()))); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/DateFormatTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import static org.hamcrest.core.IsEqual.equalTo; 4 | import static org.hamcrest.core.IsNot.not; 5 | import static org.junit.Assert.assertThat; 6 | 7 | import java.text.DateFormat; 8 | 9 | import org.junit.Test; 10 | 11 | public class DateFormatTest { 12 | @Test 13 | public void getAvailableLocalesTest() { 14 | assertThat(DateFormat.getAvailableLocales(), not(equalTo(DateFormat.getAvailableLocales()))); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/BreakIteratorTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import static org.hamcrest.core.IsEqual.equalTo; 4 | import static org.hamcrest.core.IsNot.not; 5 | import static org.junit.Assert.assertThat; 6 | 7 | import java.text.BreakIterator; 8 | 9 | import org.junit.Test; 10 | 11 | public class BreakIteratorTest { 12 | 13 | @Test 14 | public void getAvailableLocalesTest() { 15 | assertThat(BreakIterator.getAvailableLocales(), not(equalTo(BreakIterator.getAvailableLocales()))); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/DecimalFormatSymbolsTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import static org.hamcrest.core.IsEqual.equalTo; 4 | import static org.hamcrest.core.IsNot.not; 5 | import static org.junit.Assert.assertThat; 6 | 7 | import java.text.DecimalFormatSymbols; 8 | 9 | import org.junit.Test; 10 | 11 | public class DecimalFormatSymbolsTest { 12 | @Test 13 | public void getAvailableSymbolsTest() { 14 | assertThat(DecimalFormatSymbols.getAvailableLocales(), not(equalTo(DecimalFormatSymbols.getAvailableLocales()))); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/comprehensive/verify.groovy: -------------------------------------------------------------------------------- 1 | File nondexDirectory = new File( basedir, ".nondex" ); 2 | 3 | sleep(3000) 4 | assert nondexDirectory.isDirectory(); 5 | 6 | // Every run adds 5 directories. Latest and jar are static 7 | assert (nondexDirectory.list().length - 2) % 5 == 0; 8 | 9 | def nondexFolder = new File(".nondex") 10 | dirs = nondexFolder.listFiles() 11 | 12 | for (File f : dirs) { 13 | if (f.getName().startsWith("clean")) { 14 | failures = new File(f.getAbsolutePath() + File.pathSeparator + "failures"); 15 | // in the clean phase all tests should fail, meaning at least 40 16 | assert Files.readAllLines(failures.getPath(), Charset.defaultCharset()).size() > 40; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/test/java/edu/illinois/nondex/gradle/plugin/NonDexGradlePluginTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.gradle.plugin; 2 | 3 | import org.gradle.testfixtures.ProjectBuilder; 4 | import org.gradle.api.Project; 5 | import org.junit.jupiter.api.Test; 6 | import static org.junit.jupiter.api.Assertions.assertNotNull; 7 | 8 | class NonDexGradlePluginTest { 9 | @Test 10 | void pluginRegistersATask() { 11 | Project project = ProjectBuilder.builder().build(); 12 | project.getPlugins().apply("edu.illinois.nondex"); 13 | assertNotNull(project.getTasks().findByName("nondexTest")); 14 | assertNotNull(project.getTasks().findByName("nondexClean")); 15 | assertNotNull(project.getTasks().findByName("nondexDebug")); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/excluded-tests-it/module1/src/test/java/edu/illinois/nondex/functionalTest/ExcludedTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertTrue; 6 | import static org.junit.Assert.assertFalse; 7 | 8 | import java.util.HashSet; 9 | 10 | public class ExcludedTest { 11 | 12 | @Test 13 | public void testModuleExclude() { 14 | assertTrue(false); 15 | } 16 | 17 | @Test 18 | public void testNonDexExclude() { 19 | HashSet hs = new HashSet(); 20 | for (int i = 0; i < 10; i++) { 21 | hs.add(i); 22 | } 23 | 24 | String s = hs.toString(); 25 | 26 | assertFalse(s.equals(hs.toString())); 27 | } 28 | 29 | @Test 30 | public void testHashSet() { 31 | assertTrue(true); 32 | } 33 | } -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/excluded-groups-it/module1/src/test/java/edu/illinois/nondex/it/ExcludedGroupsTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.it; 2 | 3 | import org.junit.Test; 4 | import org.junit.experimental.categories.Category; 5 | import static org.junit.Assert.assertTrue; 6 | import static org.junit.Assert.assertFalse; 7 | import java.util.HashSet; 8 | 9 | public class ExcludedGroupsTest { 10 | @Test 11 | @Category(edu.illinois.nondex.it.Module1Ignore.class) 12 | public void testModuleIgnore() { 13 | assertTrue(false); 14 | } 15 | 16 | @Test 17 | @Category(edu.illinois.NonDexIgnore.class) 18 | public void testNonDexIgnore() { 19 | HashSet hs = new HashSet(); 20 | for (int i = 0; i < 10; i++) { 21 | hs.add(i); 22 | } 23 | 24 | String s = hs.toString(); 25 | 26 | assertFalse(s.equals(hs.toString())); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/FileTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import static org.hamcrest.core.IsEqual.equalTo; 4 | import static org.hamcrest.core.IsNot.not; 5 | import static org.junit.Assert.assertThat; 6 | 7 | import java.io.File; 8 | 9 | import org.junit.Before; 10 | import org.junit.Test; 11 | 12 | public class FileTest { 13 | 14 | private File myDir; 15 | 16 | @Before 17 | public void setUp() { 18 | myDir = new File("."); 19 | } 20 | 21 | @Test 22 | public void listTest() { 23 | assertThat(myDir.list(), not(equalTo(myDir.list()))); 24 | } 25 | 26 | @Test 27 | public void listFilesTest() { 28 | assertThat(myDir.listFiles(), not(equalTo(myDir.listFiles()))); 29 | } 30 | 31 | /*@Test 32 | public void listRootsTest() { 33 | 34 | }*/ 35 | } 36 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/simple-it/src/test/java/edu/illinois/nondex/functionalTest/AppTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | 7 | import java.util.Set; 8 | import java.util.HashSet; 9 | import java.util.Iterator; 10 | 11 | public class AppTest { 12 | 13 | @Test 14 | public void testHashSet() { 15 | Set s = new HashSet<>(); 16 | 17 | for (int i = 0; i<1000000; i++) { 18 | s.add(i); 19 | } 20 | 21 | for (int i = 10; i<1000000; i++) { 22 | s.remove(i); 23 | } 24 | 25 | Iterator it = s.iterator(); 26 | it.next(); 27 | it.next(); 28 | it.remove(); 29 | it.next(); 30 | 31 | // this is the natural order; 2 should be removed by the iterator remove above 32 | assertEquals("To Debug", "[0, 2, 3, 4, 5, 6, 7, 8, 9]", s.toString()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/FieldTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import static org.hamcrest.core.IsEqual.equalTo; 4 | import static org.hamcrest.core.IsNot.not; 5 | import static org.junit.Assert.assertThat; 6 | 7 | import java.lang.reflect.Field; 8 | 9 | import org.junit.Before; 10 | import org.junit.Test; 11 | 12 | public class FieldTest { 13 | private Field myField; 14 | 15 | @Before 16 | public void setUp() throws NoSuchFieldException { 17 | Class clazz = ClassTestHelper.class; 18 | myField = clazz.getField("field1"); 19 | } 20 | 21 | @Test 22 | public void getDeclaredAnnotationsTest() { 23 | assertThat(myField.getDeclaredAnnotations(), not(equalTo(myField.getDeclaredAnnotations()))); 24 | } 25 | 26 | @Test 27 | public void getAnnotationsTest() { 28 | assertThat(myField.getAnnotations(), not(equalTo(myField.getAnnotations()))); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/excluded-groups-it/module1/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | excluded-groups-it 7 | nondex.plugin.it 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | module1 13 | 14 | 15 | 16 | org.apache.maven.plugins 17 | maven-surefire-plugin 18 | 2.22.2 19 | 20 | edu.illinois.nondex.it.Module1Ignore 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/DateFormatSymbolsTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import static org.hamcrest.core.IsEqual.equalTo; 4 | import static org.hamcrest.core.IsNot.not; 5 | import static org.junit.Assert.assertThat; 6 | import static org.junit.Assert.fail; 7 | 8 | import java.text.DateFormatSymbols; 9 | import java.util.Arrays; 10 | 11 | import org.junit.Test; 12 | 13 | public class DateFormatSymbolsTest { 14 | @Test 15 | public void getAvailableLocalesTest() { 16 | assertThat(DateFormatSymbols.getAvailableLocales(), not(equalTo(DateFormatSymbols.getAvailableLocales()))); 17 | } 18 | 19 | @Test 20 | public void getZoneStringsTest() { 21 | 22 | DateFormatSymbols dfs = new DateFormatSymbols(); 23 | String[][] result = dfs.getZoneStrings(); 24 | for (int i = 0; i < 10; i++) { 25 | if (!Arrays.deepEquals(result, dfs.getZoneStrings())) { 26 | return; 27 | } 28 | } 29 | fail("getZoneStrings did not extend in 10 tries; something is likely fishy."); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | -------------------------------------------------------------------------------- /nondex-annotations/src/main/java/edu/illinois/NonDexIgnore.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois; 31 | 32 | public interface NonDexIgnore { 33 | } 34 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/MethodTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import static org.hamcrest.core.IsEqual.equalTo; 4 | import static org.hamcrest.core.IsNot.not; 5 | import static org.junit.Assert.assertThat; 6 | 7 | import java.lang.reflect.Method; 8 | 9 | import org.junit.Before; 10 | import org.junit.Test; 11 | 12 | public class MethodTest { 13 | private Method myMethod; 14 | 15 | @Before 16 | public void setUp() throws NoSuchMethodException { 17 | Class clazz = ClassTestHelper.class; 18 | myMethod = clazz.getMethod("m1", Integer.class); 19 | } 20 | 21 | @Test 22 | public void getDeclaredAnnotationsTest() { 23 | assertThat(myMethod.getDeclaredAnnotations(), not(equalTo(myMethod.getDeclaredAnnotations()))); 24 | } 25 | 26 | @Test 27 | public void getExceptionTypesTest() { 28 | assertThat(myMethod.getExceptionTypes(), not(equalTo(myMethod.getExceptionTypes()))); 29 | } 30 | 31 | @Test 32 | public void getGenericExceptionTypesTest() { 33 | assertThat(myMethod.getGenericExceptionTypes(), not(equalTo(myMethod.getGenericExceptionTypes()))); 34 | } 35 | 36 | @Test 37 | public void getParamaterAnnotationsTest() { 38 | assertThat(myMethod.getParameterAnnotations(), not(equalTo(myMethod.getParameterAnnotations()))); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/main/java/edu/illinois/nondex/plugin/Failure.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.plugin; 31 | 32 | public class Failure { 33 | } 34 | -------------------------------------------------------------------------------- /nondex-common/src/main/java/edu/illinois/nondex/common/Mode.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.common; 31 | 32 | public enum Mode { 33 | FULL, ONE 34 | } 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/java,maven 2 | 3 | ### Java ### 4 | *.class 5 | 6 | # Mobile Tools for Java (J2ME) 7 | .mtj.tmp/ 8 | 9 | # Package Files # 10 | *.jar 11 | *.war 12 | *.ear 13 | 14 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 15 | hs_err_pid* 16 | 17 | 18 | ### Maven ### 19 | target/ 20 | pom.xml.tag 21 | pom.xml.releaseBackup 22 | pom.xml.versionsBackup 23 | pom.xml.next 24 | release.properties 25 | dependency-reduced-pom.xml 26 | buildNumber.properties 27 | .mvn/timing.properties 28 | 29 | ### Eclipse ### 30 | .settings 31 | .classpath 32 | .project 33 | 34 | ### nondex specific ### 35 | .nondex/ 36 | 37 | ### Idea ### 38 | .idea 39 | .idea/* 40 | *.iml 41 | 42 | ### MAC ### 43 | .DS_Store 44 | 45 | ### Emacs ### 46 | # -*- mode: gitignore; -*- 47 | *~ 48 | \#*\# 49 | /.emacs.desktop 50 | /.emacs.desktop.lock 51 | *.elc 52 | auto-save-list 53 | tramp 54 | .\#* 55 | 56 | # Org-mode 57 | .org-id-locations 58 | *_archive 59 | 60 | # flymake-mode 61 | *_flymake.* 62 | 63 | # eshell files 64 | /eshell/history 65 | /eshell/lastdir 66 | 67 | # elpa packages 68 | /elpa/ 69 | 70 | # reftex files 71 | *.rel 72 | 73 | # AUCTeX auto folder 74 | /auto/ 75 | 76 | # cask packages 77 | .cask/ 78 | dist/ 79 | 80 | # Flycheck 81 | flycheck_*.el 82 | 83 | # server auth directory 84 | /server/ 85 | 86 | # projectiles files 87 | .projectile 88 | 89 | # directory configuration 90 | .dir-locals.el 91 | 92 | # End of https://www.gitignore.io/api/emacs -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/main/java/edu/illinois/nondex/gradle/internal/DebugExecuter.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.gradle.internal; 2 | 3 | import edu.illinois.nondex.common.Configuration; 4 | import edu.illinois.nondex.gradle.tasks.AbstractNonDexTest; 5 | import org.gradle.api.internal.tasks.testing.JvmTestExecutionSpec; 6 | import org.gradle.api.internal.tasks.testing.TestExecuter; 7 | import org.gradle.api.internal.tasks.testing.TestResultProcessor; 8 | 9 | public class DebugExecuter implements TestExecuter { 10 | 11 | private final AbstractNonDexTest nondexTestTask; 12 | private final TestExecuter delegate; 13 | private Configuration configuration; 14 | 15 | public DebugExecuter(AbstractNonDexTest nondexTestTask, TestExecuter delegate) { 16 | this.nondexTestTask = nondexTestTask; 17 | this.delegate = delegate; 18 | } 19 | 20 | public void setConfiguration(Configuration configuration) { 21 | this.configuration = configuration; 22 | } 23 | 24 | @Override 25 | public void execute(JvmTestExecutionSpec spec, TestResultProcessor testResultProcessor) { 26 | NonDexTestProcessor nondexTestProcessor = new NonDexTestProcessor(testResultProcessor); 27 | NonDexRun nondexRun = new NonDexRun(configuration, nondexTestTask, this.delegate, spec, nondexTestProcessor); 28 | nondexRun.run(); 29 | } 30 | 31 | @Override 32 | public void stopNow() { 33 | delegate.stopNow(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/multiple-surefire-executions/src/test/java/edu/illinois/nondex/it/AppExec1Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2025 Steven Kusuman 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package edu.illinois.nondex.it; 26 | 27 | import org.junit.Test; 28 | import static org.junit.Assert.assertEquals; 29 | 30 | public class AppExec1Test 31 | { 32 | @Test 33 | public void testFlag1() { 34 | assertEquals("2", System.getProperty("env.flag")); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: '{build}' 2 | install: 3 | - ps: | 4 | Add-Type -AssemblyName System.IO.Compression.FileSystem 5 | if (!(Test-Path -Path "C:\maven" )) { 6 | (new-object System.Net.WebClient).DownloadFile( 7 | 'http://www.us.apache.org/dist/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.zip', 8 | 'C:\maven-bin.zip' 9 | ) 10 | [System.IO.Compression.ZipFile]::ExtractToDirectory("C:\maven-bin.zip", "C:\maven") 11 | } 12 | - cmd: SET JAVA_HOME=C:\Program Files\Java\jdk1.8.0 13 | - cmd: SET PATH=C:\maven\apache-maven-3.2.5\bin;%JAVA_HOME%\bin;%PATH% 14 | - cmd: SET M2_HOME=C:\maven\apache-maven-3.2.5\ 15 | - cmd: SET MAVEN_OPTS=-XX:MaxPermSize=2g -Xmx4g 16 | - cmd: SET JAVA_OPTS=-XX:MaxPermSize=2g -Xmx4g 17 | build_script: 18 | - cmd: DEL nondex-common\checkstyle.xml nondex-instrumentation\checkstyle.xml nondex-maven-plugin\checkstyle.xml nondex-annotations\checkstyle.xml nondex-test\checkstyle.xml 19 | - cmd: DEL nondex-maven-plugin\src\it\comprehensive\src\test 20 | - cmd: MKLINK "nondex-common\checkstyle.xml" "checkstyle.xml" 21 | - cmd: MKLINK "nondex-instrumentation\checkstyle.xml" "checkstyle.xml" 22 | - cmd: MKLINK "nondex-maven-plugin\checkstyle.xml" "checkstyle.xml" 23 | - cmd: MKLINK "nondex-annotations\checkstyle.xml" "checkstyle.xml" 24 | - cmd: MKLINK "nondex-test\checkstyle.xml" "checkstyle.xml" 25 | - cmd: MKLINK "nondex-maven-plugin\src\it\comprehensive\src\test" "nondex-core\src\test\" 26 | - mvn -version 27 | - mvn clean package --batch-mode -DskipTests 28 | test_script: 29 | - mvn clean verify 30 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/TestAnnotation1.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import java.lang.annotation.Retention; 33 | import java.lang.annotation.RetentionPolicy; 34 | 35 | @Retention(RetentionPolicy.RUNTIME) 36 | public @interface TestAnnotation1 {} 37 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/TestAnnotation2.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import java.lang.annotation.Retention; 33 | import java.lang.annotation.RetentionPolicy; 34 | 35 | @Retention(RetentionPolicy.RUNTIME) 36 | public @interface TestAnnotation2 { 37 | } 38 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/TestAnnotation3.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import java.lang.annotation.Retention; 33 | import java.lang.annotation.RetentionPolicy; 34 | 35 | @Retention(RetentionPolicy.RUNTIME) 36 | public @interface TestAnnotation3 { 37 | } 38 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/TestAnnotation4.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import java.lang.annotation.Retention; 33 | import java.lang.annotation.RetentionPolicy; 34 | 35 | @Retention(RetentionPolicy.RUNTIME) 36 | public @interface TestAnnotation4 { 37 | } 38 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/TestAnnotation5.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import java.lang.annotation.Retention; 33 | import java.lang.annotation.RetentionPolicy; 34 | 35 | @Retention(RetentionPolicy.RUNTIME) 36 | public @interface TestAnnotation5 { 37 | } 38 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/TestAnnotation6.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import java.lang.annotation.Retention; 33 | import java.lang.annotation.RetentionPolicy; 34 | 35 | @Retention(RetentionPolicy.RUNTIME) 36 | public @interface TestAnnotation6 { 37 | } 38 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/TestAnnotation7.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import java.lang.annotation.Retention; 33 | import java.lang.annotation.RetentionPolicy; 34 | 35 | @Retention(RetentionPolicy.RUNTIME) 36 | public @interface TestAnnotation7 { 37 | } 38 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/TestAnnotation8.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import java.lang.annotation.Retention; 33 | import java.lang.annotation.RetentionPolicy; 34 | 35 | @Retention(RetentionPolicy.RUNTIME) 36 | public @interface TestAnnotation8 { 37 | } 38 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/multiple-surefire-executions/src/test/java/edu/illinois/nondex/it/AppExec2Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2025 Steven Kusuman 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package edu.illinois.nondex.it; 26 | 27 | import org.junit.Test; 28 | import org.junit.experimental.categories.Category; 29 | import static org.junit.Assert.assertEquals; 30 | 31 | public class AppExec2Test 32 | { 33 | @Test 34 | public void testFlag2() { 35 | assertEquals("1", System.getProperty("env.flag")); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/failing-it/src/test/java/edu/illinois/nondex/it/AppTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining 10 | a copy of this software and associated documentation files (the 11 | "Software"), to deal in the Software without restriction, including 12 | without limitation the rights to use, copy, modify, merge, publish, 13 | distribute, sublicense, and/or sell copies of the Software, and to 14 | permit persons to whom the Software is furnished to do so, subject to 15 | the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be 18 | included in all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | package edu.illinois.nondex.it; 30 | 31 | import org.junit.Test; 32 | import static org.junit.Assert.assertTrue; 33 | 34 | 35 | public class AppTest 36 | { 37 | 38 | @Test 39 | public void testHashSet() { 40 | assertTrue(false); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/inexistent-variable-argline-it/src/test/java/edu/illinois/nondex/it/AppTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining 10 | a copy of this software and associated documentation files (the 11 | "Software"), to deal in the Software without restriction, including 12 | without limitation the rights to use, copy, modify, merge, publish, 13 | distribute, sublicense, and/or sell copies of the Software, and to 14 | permit persons to whom the Software is furnished to do so, subject to 15 | the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be 18 | included in all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | package edu.illinois.nondex.it; 30 | 31 | import org.junit.Test; 32 | import static org.junit.Assert.assertTrue; 33 | 34 | public class AppTest 35 | { 36 | @Test 37 | public void testExecuted() { 38 | assertTrue(true); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven 3 | 4 | # This workflow uses actions that are not certified by GitHub. 5 | # They are provided by a third-party and are governed by 6 | # separate terms of service, privacy policy, and support 7 | # documentation. 8 | 9 | name: Java CI 10 | 11 | on: 12 | push: 13 | branches: [ "master" ] 14 | pull_request: 15 | branches: [ "master" ] 16 | 17 | jobs: 18 | maven-build: 19 | runs-on: ${{ matrix.os }} 20 | 21 | strategy: 22 | matrix: 23 | os: [ubuntu-latest] 24 | java-version: [8,11,17,21,25] 25 | fail-fast: false 26 | 27 | steps: 28 | - uses: actions/checkout@v4 29 | - uses: actions/setup-java@v4 30 | with: 31 | distribution: 'temurin' 32 | java-version: ${{ matrix.java-version }} 33 | - run: mvn verify -B 34 | 35 | gradle-build: 36 | runs-on: ${{ matrix.os }} 37 | 38 | strategy: 39 | matrix: 40 | os: [ubuntu-latest] 41 | java-version: [8,11,17,21] 42 | fail-fast: false 43 | 44 | steps: 45 | - uses: actions/checkout@v4 46 | - uses: actions/setup-java@v4 47 | with: 48 | distribution: 'temurin' 49 | java-version: ${{ matrix.java-version }} 50 | - name: Make gradlew executable 51 | run: chmod +x nondex-gradle-plugin/gradlew 52 | 53 | - name: Build with Gradle 54 | run: cd nondex-gradle-plugin && ./gradlew check -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/clean-it with-whitespace-in-path/src/test/java/edu/illinois/nondex/it/AppTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2015 Owolabi Legunsen 5 | Copyright (c) 2015 Darko Marinov 6 | Copyright (c) 2015 August Shi 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | "Software"), to deal in the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be 17 | included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 23 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | package edu.illinois.nondex.it; 29 | 30 | import org.junit.Test; 31 | import org.junit.experimental.categories.Category; 32 | import static org.junit.Assert.assertTrue; 33 | 34 | public class AppTest 35 | { 36 | @Test 37 | public void testHashSet() { 38 | assertTrue(true); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modify-gradle-build/add-nondex.sh: -------------------------------------------------------------------------------- 1 | cd $1 2 | buildFile=$(./gradlew properties | grep buildFile | awk '{print $2}') 3 | output=$(./gradlew projects) 4 | echo "$output" | grep "No sub-projects" > /dev/null 5 | sub=$? 6 | echo ${sub} 7 | grep "edu.illinois.nondex" ${buildFile} 8 | if [ $? != 0 ]; then 9 | if [ "$sub" == 0 ]; then 10 | echo "\napply plugin: 'edu.illinois.nondex'" >> ${buildFile} 11 | else 12 | for p in ${projects}; do 13 | subBuildFile=$(./gradlew :$p:properties | grep buildFile | awk '{print $2}') 14 | sed -i 's/^\( \|\t\)*test /tasks.withType(Test) /' ${subBuildFile}; 15 | done 16 | projects=$(./gradlew projects | grep Project | cut -f3 -d" " | tr -d "':") 17 | if [[ "$OSTYPE" == "darwin"* ]]; then 18 | echo "\nsubprojects {\n apply plugin: 'edu.illinois.nondex'\n}" >> ${buildFile} # macOS 19 | else 20 | echo -e "\nsubprojects {\n apply plugin: 'edu.illinois.nondex'\n}" >> ${buildFile} # Linux 21 | fi 22 | fi 23 | echo "buildscript { 24 | repositories { 25 | maven { 26 | url = uri('https://plugins.gradle.org/m2/') 27 | } 28 | } 29 | dependencies { 30 | classpath('edu.illinois:plugin:2.2.1') 31 | } 32 | } 33 | $(cat ${buildFile})" > ${buildFile} 34 | fi 35 | if [[ "$OSTYPE" == "darwin"* ]]; then 36 | sed -i '' 's/^\( \|\t\)*test /tasks.withType(Test) /' "${buildFile}" # macOS 37 | else 38 | sed -i 's/^\( \|\t\)*test /tasks.withType(Test) /' "${buildFile}" # Linux 39 | fi 40 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/clean-it/src/test/java/edu/illinois/nondex/it/AppTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining 10 | a copy of this software and associated documentation files (the 11 | "Software"), to deal in the Software without restriction, including 12 | without limitation the rights to use, copy, modify, merge, publish, 13 | distribute, sublicense, and/or sell copies of the Software, and to 14 | permit persons to whom the Software is furnished to do so, subject to 15 | the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be 18 | included in all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | package edu.illinois.nondex.it; 30 | 31 | import org.junit.Test; 32 | import org.junit.experimental.categories.Category; 33 | import static org.junit.Assert.assertTrue; 34 | 35 | public class AppTest 36 | { 37 | @Test 38 | public void testHashSet() { 39 | assertTrue(true); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/failing-it/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | nondex.plugin.it 7 | simple-it 8 | 1.0-SNAPSHOT 9 | 10 | A simple IT verifying the basic use case. 11 | 12 | 13 | UTF-8 14 | 15 | 16 | 17 | 18 | 19 | org.apache.maven.plugins 20 | maven-compiler-plugin 21 | 3.8.1 22 | 23 | 1.8 24 | 1.8 25 | 26 | 27 | 28 | @project.groupId@ 29 | @project.artifactId@ 30 | @project.version@ 31 | 32 | 33 | org.apache.maven.plugins 34 | maven-surefire-plugin 35 | 2.22.2 36 | 37 | 38 | 39 | 40 | 41 | 42 | junit 43 | junit 44 | 4.13.2 45 | test 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/simple-it/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | nondex.plugin.it 7 | simple-it 8 | 1.0-SNAPSHOT 9 | 10 | A simple IT verifying the basic use case. 11 | 12 | 13 | UTF-8 14 | 15 | 16 | 17 | 18 | 19 | org.apache.maven.plugins 20 | maven-compiler-plugin 21 | 3.8.1 22 | 23 | 1.8 24 | 1.8 25 | 26 | 27 | 28 | @project.groupId@ 29 | @project.artifactId@ 30 | @project.version@ 31 | 32 | 33 | org.apache.maven.plugins 34 | maven-surefire-plugin 35 | 2.22.2 36 | 37 | 38 | 39 | 40 | 41 | 42 | junit 43 | junit 44 | 4.13.2 45 | test 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/clean-it/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | nondex.plugin.it 7 | simple-it 8 | 1.0-SNAPSHOT 9 | 10 | A simple IT verifying the basic use of clean Mojo. 11 | 12 | 13 | UTF-8 14 | 15 | 16 | 17 | 18 | 19 | org.apache.maven.plugins 20 | maven-compiler-plugin 21 | 3.8.1 22 | 23 | 1.8 24 | 1.8 25 | 26 | 27 | 28 | @project.groupId@ 29 | @project.artifactId@ 30 | @project.version@ 31 | 32 | 33 | org.apache.maven.plugins 34 | maven-surefire-plugin 35 | 2.22.2 36 | 37 | 38 | 39 | 40 | 41 | 42 | junit 43 | junit 44 | 4.13.2 45 | test 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/main/java/edu/illinois/nondex/gradle/tasks/NonDexClean.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.gradle.tasks; 2 | 3 | import edu.illinois.nondex.common.ConfigurationDefaults; 4 | import org.gradle.api.DefaultTask; 5 | import org.gradle.api.tasks.TaskAction; 6 | 7 | import java.io.File; 8 | import java.nio.file.Path; 9 | import java.nio.file.Paths; 10 | 11 | public class NonDexClean extends DefaultTask { 12 | 13 | static final String NAME = "nondexClean"; 14 | 15 | public static String getNAME() { return NAME; } 16 | 17 | public NonDexClean() { 18 | setDescription("Clean Nondex jar and directory"); 19 | setGroup("NonDex"); 20 | } 21 | 22 | @TaskAction 23 | void cleanNonDexFiles() { 24 | 25 | String userDirectory = getProject().getProjectDir().getAbsolutePath(); 26 | 27 | Path nondexArtifactsPath = Paths.get(userDirectory, ConfigurationDefaults.DEFAULT_NONDEX_DIR); 28 | 29 | Path nondexJarPath = Paths.get(userDirectory, 30 | ConfigurationDefaults.DEFAULT_NONDEX_JAR_DIR, 31 | ConfigurationDefaults.INSTRUMENTATION_JAR); 32 | 33 | File artifactsDir = nondexArtifactsPath.toFile(); 34 | File nondexJar = nondexJarPath.toFile(); 35 | 36 | if (nondexJar.exists()) { 37 | delete(nondexJar); 38 | } 39 | 40 | if (artifactsDir.exists()) { 41 | delete(artifactsDir); 42 | } 43 | } 44 | 45 | void delete(File file) { 46 | if (file.isDirectory()) { 47 | for (File childFile : file.listFiles()) { 48 | delete(childFile); 49 | } 50 | } 51 | file.delete(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /nondex-annotations/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | nondex 5 | edu.illinois 6 | 2.2.5-SNAPSHOT 7 | 8 | 4.0.0 9 | 10 | nondex-annotations 11 | 12 | 13 | 14 | 15 | org.apache.maven.plugins 16 | maven-checkstyle-plugin 17 | 3.1.1 18 | 19 | checkstyle.xml 20 | UTF-8 21 | true 22 | true 23 | true 24 | true 25 | false 26 | 27 | 28 | 29 | com.puppycrawl.tools 30 | checkstyle 31 | 8.29 32 | 33 | 34 | 35 | 36 | validate 37 | validate 38 | 39 | check 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/main/java/edu/illinois/nondex/gradle/plugin/NonDexGradlePlugin.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.gradle.plugin; 2 | 3 | import edu.illinois.nondex.gradle.tasks.NonDexClean; 4 | import edu.illinois.nondex.gradle.tasks.NonDexDebug; 5 | import edu.illinois.nondex.gradle.tasks.NonDexTest; 6 | import org.gradle.api.Project; 7 | import org.gradle.api.Plugin; 8 | import org.gradle.api.artifacts.Configuration; 9 | import org.gradle.api.artifacts.repositories.MavenArtifactRepository; 10 | 11 | import static edu.illinois.nondex.gradle.constants.NonDexGradlePluginConstants.NONDEX_VERSION; 12 | 13 | public class NonDexGradlePlugin implements Plugin { 14 | 15 | public void apply(Project project) { 16 | project.getTasks().create(NonDexTest.getNAME(), NonDexTest.class); 17 | project.getTasks().create(NonDexClean.getNAME(), NonDexClean.class); 18 | project.getTasks().create(NonDexDebug.getNAME(), NonDexDebug.class); 19 | downloadNonDexCommonJar(project.getRootProject()); 20 | } 21 | 22 | private void downloadNonDexCommonJar(Project project) { 23 | Configuration config = project.getConfigurations().create("downloadNonDexCommonJar"); 24 | project.getDependencies().add(config.getName(), "edu.illinois:nondex-common:" + NONDEX_VERSION); 25 | MavenArtifactRepository mavenCentral = project.getRepositories().mavenCentral(); 26 | if (project.getRepositories().contains(mavenCentral)) { 27 | config.resolve(); 28 | } else { 29 | project.getRepositories().add(mavenCentral); 30 | config.resolve(); 31 | project.getRepositories().remove(mavenCentral); 32 | } 33 | project.getConfigurations().remove(config); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/clean-it with-whitespace-in-path/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | nondex.plugin.it 7 | simple-it 8 | 1.0-SNAPSHOT 9 | 10 | A simple IT verifying the basic use of clean Mojo when the path to the project contains whitespaces. 11 | 12 | 13 | UTF-8 14 | 15 | 16 | 17 | 18 | 19 | org.apache.maven.plugins 20 | maven-compiler-plugin 21 | 3.8.1 22 | 23 | 1.8 24 | 1.8 25 | 26 | 27 | 28 | @project.groupId@ 29 | @project.artifactId@ 30 | @project.version@ 31 | 32 | 33 | org.apache.maven.plugins 34 | maven-surefire-plugin 35 | 2.22.2 36 | 37 | 38 | 39 | 40 | 41 | 42 | junit 43 | junit 44 | 4.13.2 45 | test 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/CollatorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import static org.hamcrest.core.IsEqual.equalTo; 33 | import static org.hamcrest.core.IsNot.not; 34 | import static org.junit.Assert.assertThat; 35 | 36 | import java.text.Collator; 37 | 38 | import org.junit.Test; 39 | 40 | public class CollatorTest { 41 | @Test 42 | public void getAvailableLocalesTest() { 43 | assertThat(Collator.getAvailableLocales(), not(equalTo(Collator.getAvailableLocales()))); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/AbstractCollectionTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import edu.illinois.nondex.shuffling.ControlNondeterminism; 4 | 5 | import org.junit.Assert; 6 | 7 | public abstract class AbstractCollectionTest { 8 | 9 | protected abstract T createResizedDS(); 10 | 11 | protected abstract T createResizedDS(int start, int maxSize); 12 | 13 | protected abstract T addRemoveDS(T ds); 14 | 15 | protected void assertParameterized(T ds, Object derived, String str) { 16 | switch (ControlNondeterminism.getConfiguration().mode) { 17 | case FULL: 18 | String tempStr = derived.toString(); 19 | Assert.assertNotEquals("FULL is improperly running", str, tempStr); 20 | this.assertEqualstUnordered("Does not match permutation", str, tempStr); 21 | break; 22 | case ONE: 23 | Assert.assertEquals("ONE is improperly running", str, derived.toString()); 24 | break; 25 | default: 26 | break; 27 | } 28 | } 29 | 30 | protected void assertEqualstUnordered(String msg, String expected, String actual) { 31 | Assert.assertEquals(msg + ": " + expected + " =/= " + actual, expected.length(), actual.length()); 32 | String trimmed = expected.substring(1, expected.length() - 1); 33 | String[] elems = trimmed.split(","); 34 | // TODO(gyori): fix and make this more robust. It does not check duplicates, substrings, etc. 35 | for (int i = 0; i < elems.length; i++) { 36 | elems[i] = elems[i].trim(); 37 | Assert.assertTrue(msg + ": " + trimmed + " =/= " + actual, actual.contains(elems[i])); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'groovy' 3 | id 'java-gradle-plugin' 4 | id "com.gradle.plugin-publish" version "1.3.0" 5 | } 6 | 7 | group = "edu.illinois" 8 | version = "2.2.1" 9 | 10 | repositories { 11 | mavenCentral() 12 | } 13 | 14 | dependencies { 15 | testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2' 16 | implementation 'com.google.guava:guava:31.1-jre' 17 | implementation 'org.apache.commons:commons-lang3:3.12.0' 18 | implementation 'edu.illinois:nondex-common:' + version 19 | implementation 'edu.illinois:nondex-instrumentation:' + version 20 | } 21 | 22 | gradlePlugin { 23 | website = 'https://github.com/TestingResearchIllinois/NonDex' 24 | vcsUrl = 'https://github.com/TestingResearchIllinois/NonDex' 25 | description = 'NonDex plugin for Gradle' 26 | plugins { 27 | nondexPlugin { 28 | id = 'edu.illinois.nondex' 29 | displayName = 'Nondex plugin for Gradle' 30 | implementationClass = 'edu.illinois.nondex.gradle.plugin.NonDexGradlePlugin' 31 | description = 'NonDex Gradle plugin' 32 | tags.addAll('non-deterministic', 'test') 33 | } 34 | } 35 | } 36 | 37 | sourceSets { 38 | functionalTest { 39 | } 40 | } 41 | 42 | configurations.functionalTestImplementation.extendsFrom(configurations.testImplementation) 43 | 44 | // Add a task to run the functional tests 45 | tasks.register('functionalTest', Test) { 46 | testClassesDirs = sourceSets.functionalTest.output.classesDirs 47 | classpath = sourceSets.functionalTest.runtimeClasspath 48 | useJUnitPlatform() 49 | } 50 | 51 | gradlePlugin.testSourceSets(sourceSets.functionalTest) 52 | 53 | tasks.named('test') { 54 | useJUnitPlatform() 55 | } 56 | 57 | compileJava { 58 | sourceCompatibility = 8 59 | targetCompatibility = 8 60 | } 61 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/DateFormatTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import static org.hamcrest.core.IsEqual.equalTo; 33 | import static org.hamcrest.core.IsNot.not; 34 | import static org.junit.Assert.assertThat; 35 | 36 | import java.text.DateFormat; 37 | 38 | import org.junit.Test; 39 | 40 | public class DateFormatTest { 41 | @Test 42 | public void getAvailableLocalesTest() { 43 | assertThat(DateFormat.getAvailableLocales(), not(equalTo(DateFormat.getAvailableLocales()))); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/BreakIteratorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import static org.hamcrest.core.IsEqual.equalTo; 33 | import static org.hamcrest.core.IsNot.not; 34 | import static org.junit.Assert.assertThat; 35 | 36 | import java.text.BreakIterator; 37 | 38 | import org.junit.Test; 39 | 40 | public class BreakIteratorTest { 41 | 42 | @Test 43 | public void getAvailableLocalesTest() { 44 | assertThat(BreakIterator.getAvailableLocales(), not(equalTo(BreakIterator.getAvailableLocales()))); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/main/java/edu/illinois/nondex/gradle/util/MavenChecksumFetcher.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.gradle.util; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStreamReader; 5 | import java.net.HttpURLConnection; 6 | import java.net.URL; 7 | 8 | public class MavenChecksumFetcher { 9 | 10 | /** 11 | * Fetches the SHA1 checksum of a JAR file from Maven Central repository. 12 | * 13 | * This method constructs the URL to the checksum file for a given artifact based on its 14 | * groupId, artifactId, and version, then makes an HTTP GET request to fetch the SHA1 checksum. 15 | * It returns the SHA1 checksum as a string. 16 | * 17 | * @param groupId The group ID of the artifact (e.g., "edu.illinois") 18 | * @param artifactId The artifact ID of the artifact (e.g., "nondex-common") 19 | * @param version The version of the artifact (e.g., "2.2.1") 20 | * @return The SHA1 checksum of the artifact as a string 21 | */ 22 | public static String getSHA1(String groupId, String artifactId, String version) { 23 | try { 24 | String baseUrl = "https://repo1.maven.org/maven2/"; 25 | String sha1Url = baseUrl + groupId.replace(".", "/") + "/" + artifactId + "/" + version + "/" 26 | + artifactId + "-" + version + ".jar.sha1"; 27 | 28 | URL url = new URL(sha1Url); 29 | HttpURLConnection connection = (HttpURLConnection) url.openConnection(); 30 | connection.setRequestMethod("GET"); 31 | 32 | try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { 33 | return reader.readLine(); // Returns the SHA1 checksum 34 | } 35 | } catch (Exception e) { 36 | return null; 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | it-repo 26 | 27 | true 28 | 29 | 30 | 31 | local.central 32 | @localRepositoryUrl@ 33 | 34 | true 35 | 36 | 37 | true 38 | 39 | 40 | 41 | 42 | 43 | local.central 44 | @localRepositoryUrl@ 45 | 46 | true 47 | 48 | 49 | true 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/DecimalFormatSymbolsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import static org.hamcrest.core.IsEqual.equalTo; 33 | import static org.hamcrest.core.IsNot.not; 34 | import static org.junit.Assert.assertThat; 35 | 36 | import java.text.DecimalFormatSymbols; 37 | 38 | import org.junit.Test; 39 | 40 | public class DecimalFormatSymbolsTest { 41 | @Test 42 | public void getAvailableSymbolsTest() { 43 | assertThat(DecimalFormatSymbols.getAvailableLocales(), not(equalTo(DecimalFormatSymbols.getAvailableLocales()))); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/main/java/edu/illinois/nondex/gradle/tasks/NonDexTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.gradle.tasks; 2 | 3 | import edu.illinois.nondex.gradle.internal.NonDexTestExecuter; 4 | import org.gradle.api.internal.tasks.testing.JvmTestExecutionSpec; 5 | import org.gradle.api.internal.tasks.testing.TestExecuter; 6 | import org.gradle.api.tasks.testing.Test; 7 | 8 | import java.lang.reflect.Method; 9 | 10 | public class NonDexTest extends AbstractNonDexTest { 11 | 12 | static final String NAME = "nondexTest"; 13 | 14 | public static String getNAME() { return NAME; } 15 | 16 | public NonDexTest() { 17 | setDescription("Test with NonDex"); 18 | setGroup("NonDex"); 19 | NonDexTestExecuter nondexTestExecuter = createNondexTestExecuter(); 20 | setNondexAsTestExecuter(nondexTestExecuter); 21 | } 22 | 23 | @Override 24 | public void executeTests() { 25 | setUpNondexTesting(); 26 | super.executeTests(); 27 | } 28 | 29 | private NonDexTestExecuter createNondexTestExecuter() { 30 | try { 31 | Method getExecuter = Test.class.getDeclaredMethod("createTestExecuter"); 32 | getExecuter.setAccessible(true); 33 | TestExecuter delegate = (TestExecuter) getExecuter.invoke(this); 34 | return new NonDexTestExecuter(this, delegate); 35 | } catch (Exception e) { 36 | throw new RuntimeException(e); 37 | } 38 | } 39 | 40 | private void setNondexAsTestExecuter(NonDexTestExecuter nondexExecuter) { 41 | try { 42 | Method setTestExecuter = Test.class.getDeclaredMethod("setTestExecuter", TestExecuter.class); 43 | setTestExecuter.setAccessible(true); 44 | setTestExecuter.invoke(this, nondexExecuter); 45 | } catch (Exception e) { 46 | throw new RuntimeException(e); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/inexistent-variable-argline-it/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | nondex.plugin.it 7 | simple-it 8 | 1.0-SNAPSHOT 9 | 10 | A simple IT verifying the use of defined and undefined properties. 11 | 12 | 13 | UTF-8 14 | -DthroughProperty=3423 15 | 16 | 17 | 18 | 19 | 20 | org.apache.maven.plugins 21 | maven-compiler-plugin 22 | 3.8.1 23 | 24 | 1.8 25 | 1.8 26 | 27 | 28 | 29 | @project.groupId@ 30 | @project.artifactId@ 31 | @project.version@ 32 | 33 | 34 | org.apache.maven.plugins 35 | maven-surefire-plugin 36 | 2.22.2 37 | 38 | ${some-nonexistent-argline} -DmyArgumentForTesting=1219 ${some.stuff} ${some.existing} ${An0ther-st.uff} 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | junit 47 | junit 48 | 4.13.2 49 | test 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/settings-property-argline-it/src/test/java/edu/illinois/nondex/it/SettingsArgLineTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2025 Edwin Ing 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | package edu.illinois.nondex.it; 26 | 27 | import org.junit.Test; 28 | import static org.junit.Assert.assertTrue; 29 | 30 | import java.util.HashSet; 31 | import java.util.Set; 32 | 33 | public class SettingsArgLineTest { 34 | 35 | @Test 36 | public void testNonDexRunsSuccessfully() { 37 | // This test simply verifies that NonDex can run with an argLine 38 | // containing ${settings.localRepository}. 39 | // If the settings property wasn't preserved, the javaagent path 40 | // would be malformed and the Nondex would fail to run. 41 | // verify.groovy will check afterward nondex successfully ran. 42 | assertTrue(true); //placeholder 43 | } 44 | } -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/HashSetTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import java.util.HashSet; 4 | import java.util.Iterator; 5 | import java.util.Set; 6 | 7 | import org.junit.Assert; 8 | import org.junit.Test; 9 | 10 | public class HashSetTest extends AbstractCollectionTest> { 11 | 12 | @Override 13 | protected Set createResizedDS() { 14 | return this.createResizedDS(0, 103); 15 | } 16 | 17 | @Override 18 | protected Set createResizedDS(int start, int maxSize) { 19 | Set set = new HashSet<>(); 20 | 21 | for (int i = start; i < maxSize; i++) { 22 | set.add(i); 23 | } 24 | 25 | for (int i = start + 10; i < maxSize; i++) { 26 | set.remove(i); 27 | } 28 | 29 | Assert.assertEquals("the size should be 10", 10, set.size()); 30 | 31 | return set; 32 | } 33 | 34 | @Override 35 | protected Set addRemoveDS(Set ds) { 36 | ds.add(27); 37 | ds.remove(27); 38 | return ds; 39 | } 40 | 41 | 42 | @Test 43 | public void testHashSet() { 44 | Set set = this.createResizedDS(0, 100000); 45 | Iterator it = set.iterator(); 46 | it.next(); 47 | it.next(); 48 | it.remove(); 49 | it.next(); 50 | Assert.assertEquals("the size should be 9 now", 9, set.size()); 51 | // this is the natural order; 2 should be removed by the iterator remove above 52 | Assert.assertNotEquals("You are likely running an unchanged JVM", 53 | "[0, 2, 3, 4, 5, 6, 7, 8, 9]", set.toString()); 54 | } 55 | 56 | @Test 57 | public void testHashSetParametrized() { 58 | Set set = this.createResizedDS(0, 100000); 59 | this.assertParameterized(set, set, set.toString()); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/comprehensive/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | nondex.plugin.it 7 | simple-it 8 | 1.0-SNAPSHOT 9 | 10 | A simple IT verifying the basic use case. 11 | 12 | 13 | UTF-8 14 | 15 | 16 | 17 | 18 | 19 | org.apache.maven.plugins 20 | maven-compiler-plugin 21 | 3.8.1 22 | 23 | 1.8 24 | 1.8 25 | 26 | 27 | 28 | @project.groupId@ 29 | @project.artifactId@ 30 | @project.version@ 31 | 32 | 33 | org.apache.maven.plugins 34 | maven-surefire-plugin 35 | 2.22.2 36 | 37 | 2 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | junit 46 | junit 47 | 4.13.2 48 | test 49 | 50 | 51 | @project.groupId@ 52 | nondex-common 53 | @project.version@ 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/simple-multimodule-it/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | nondex.plugin.it 7 | excluded-groups-it 8 | 1.0-SNAPSHOT 9 | pom 10 | IT verifying excluded groups 11 | 12 | 13 | UTF-8 14 | 15 | 16 | 17 | module1 18 | module2 19 | 20 | 21 | 22 | 23 | 24 | org.apache.maven.plugins 25 | maven-compiler-plugin 26 | 3.8.1 27 | 28 | 1.8 29 | 1.8 30 | 31 | 32 | 33 | @project.groupId@ 34 | nondex-maven-plugin 35 | @project.version@ 36 | 37 | 38 | org.apache.maven.plugins 39 | maven-surefire-plugin 40 | 2.22.2 41 | 42 | -DmyArgumentForTesting=1219 43 | 2 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | junit 52 | junit 53 | 4.12 54 | test 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /nondex-instrumentation/src/main/java/edu/illinois/nondex/instr/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.instr; 31 | 32 | import edu.illinois.nondex.common.Utils; 33 | 34 | public class Main { 35 | public static void main(String...args) throws Exception { 36 | if (args.length == 1) { 37 | String rtPath = ""; 38 | if (Utils.checkJDK8()) { 39 | rtPath = Utils.getRtJarLocation().toString(); 40 | } 41 | Instrumenter.instrument(rtPath, args[0]); 42 | } else if (args.length == 2) { 43 | Instrumenter.instrument(args[0], args[1]); 44 | } else { 45 | throw new IllegalArgumentException("Expecting 1 or 2 arguments: [/path/to/rt.jar] /path/to/output.jar"); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /nondex-common/src/main/java/edu/illinois/nondex/common/Level.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.common; 31 | 32 | public enum Level { 33 | ALL(Integer.MIN_VALUE, "ALL"), 34 | FINEST(300, "FINEST"), 35 | FINER(400, "FINER"), 36 | FINE(500, "FINE"), 37 | CONFIG(700, "CONFIG"), 38 | INFO(800, "INFO"), 39 | WARNING(900, "WARNING"), 40 | SEVERE(1000, "SEVERE"), 41 | OFF(Integer.MAX_VALUE, "OFF"); 42 | 43 | private final int severity; 44 | 45 | private Level(int severity, String name) { 46 | this.severity = severity; 47 | } 48 | 49 | public static Level parse(String name) { 50 | return Level.valueOf(name); 51 | } 52 | 53 | public final String getName() { 54 | return name(); 55 | } 56 | 57 | public final int intValue() { 58 | return severity; 59 | } 60 | } -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/FileTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import static org.hamcrest.core.IsEqual.equalTo; 33 | import static org.hamcrest.core.IsNot.not; 34 | import static org.junit.Assert.assertThat; 35 | 36 | import java.io.File; 37 | 38 | import org.junit.Before; 39 | import org.junit.Test; 40 | 41 | public class FileTest { 42 | 43 | private File myDir; 44 | 45 | @Before 46 | public void setUp() { 47 | myDir = new File("."); 48 | } 49 | 50 | @Test 51 | public void listTest() { 52 | assertThat(myDir.list(), not(equalTo(myDir.list()))); 53 | } 54 | 55 | @Test 56 | public void listFilesTest() { 57 | assertThat(myDir.listFiles(), not(equalTo(myDir.listFiles()))); 58 | } 59 | 60 | /*@Test 61 | public void listRootsTest() { 62 | 63 | }*/ 64 | } 65 | -------------------------------------------------------------------------------- /nondex-core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | edu.illinois 6 | nondex 7 | 2.2.5-SNAPSHOT 8 | 9 | 10 | nondex-core 11 | jar 12 | nondex-core 13 | 14 | 15 | 16 | 17 | org.apache.maven.plugins 18 | maven-javadoc-plugin 19 | 20 | 21 | attach-javadocs 22 | none 23 | 24 | jar 25 | 26 | 27 | 28 | 29 | 30 | 31 | org.apache.maven.plugins 32 | maven-deploy-plugin 33 | 2.8.2 34 | 35 | true 36 | 37 | 38 | 39 | org.apache.maven.plugins 40 | maven-compiler-plugin 41 | 3.6.0 42 | 43 | 1.8 44 | 1.8 45 | 46 | -XDignore.symbol.file 47 | 48 | true 49 | 50 | 51 | 52 | default-compile 53 | none 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | edu.illinois 63 | nondex-common 64 | ${project.version} 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/ClassTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import static org.hamcrest.core.IsEqual.equalTo; 4 | import static org.hamcrest.core.IsNot.not; 5 | import static org.junit.Assert.assertThat; 6 | 7 | import org.junit.Before; 8 | import org.junit.Test; 9 | 10 | public class ClassTest { 11 | 12 | private Class clazz; 13 | 14 | @Before 15 | public void setUp() { 16 | // TODO: pick a class with annotations and test: 17 | // clazz.getAnnotations(); 18 | // clazz.getDeclaredAnnotations(); 19 | clazz = ClassTestHelper.class; 20 | } 21 | 22 | @Test 23 | public void getClassesTest() { 24 | assertThat(clazz.getClasses(), not(equalTo(clazz.getClasses()))); 25 | } 26 | 27 | @Test 28 | public void getFieldsTest() { 29 | assertThat(clazz.getFields(), not(equalTo(clazz.getFields()))); 30 | } 31 | 32 | @Test 33 | public void getDeclaredFieldsTest() { 34 | assertThat(clazz.getDeclaredFields(), not(equalTo(clazz.getDeclaredFields()))); 35 | } 36 | 37 | @Test 38 | public void getConstructorsTest() throws NoSuchMethodException { 39 | assertThat(clazz.getConstructors(), not(equalTo(clazz.getConstructors()))); 40 | } 41 | 42 | @Test 43 | public void getDeclaredConstructorsTest() { 44 | assertThat(clazz.getDeclaredConstructors(), not(equalTo(clazz.getDeclaredConstructors()))); 45 | } 46 | 47 | @Test 48 | public void getMethodsTest() { 49 | assertThat(clazz.getMethods(), not(equalTo(clazz.getMethods()))); 50 | } 51 | 52 | @Test 53 | public void getDeclaredMethodsTest() { 54 | assertThat(clazz.getDeclaredMethods(), not(equalTo(clazz.getDeclaredMethods()))); 55 | } 56 | 57 | @Test 58 | public void getAnnotationsTest() { 59 | assertThat(clazz.getAnnotations(), not(equalTo(clazz.getAnnotations()))); 60 | } 61 | 62 | @Test 63 | public void getDeclaredAnnotationsTest() { 64 | assertThat(clazz.getDeclaredAnnotations(), not(equalTo(clazz.getDeclaredAnnotations()))); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/simple-it/src/test/java/edu/illinois/nondex/it/AppTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining 10 | a copy of this software and associated documentation files (the 11 | "Software"), to deal in the Software without restriction, including 12 | without limitation the rights to use, copy, modify, merge, publish, 13 | distribute, sublicense, and/or sell copies of the Software, and to 14 | permit persons to whom the Software is furnished to do so, subject to 15 | the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be 18 | included in all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | package edu.illinois.nondex.it; 30 | 31 | import org.junit.Test; 32 | import static org.junit.Assert.assertEquals; 33 | 34 | import java.util.Set; 35 | import java.util.HashSet; 36 | import java.util.Iterator; 37 | 38 | public class AppTest 39 | { 40 | 41 | @Test 42 | public void testHashSet() { 43 | Set s = new HashSet(); 44 | 45 | for (int i = 0; i<1000000; i++) 46 | 47 | s.add(i); 48 | 49 | for (int i = 10; i<1000000; i++) 50 | s.remove(i); 51 | 52 | Iterator it = s.iterator(); 53 | it.next(); 54 | it.next(); 55 | it.remove(); 56 | it.next(); 57 | 58 | // this is the natural order; 2 should be removed by the iterator remove above 59 | assertEquals("To Debug", "[0, 2, 3, 4, 5, 6, 7, 8, 9]", s.toString()); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/ClassTestHelper.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | @TestAnnotation1 4 | @TestAnnotation2 5 | @TestAnnotation3 6 | @TestAnnotation4 7 | @TestAnnotation5 8 | @TestAnnotation6 9 | @TestAnnotation7 10 | @TestAnnotation8 11 | public class ClassTestHelper { 12 | 13 | public class InnerOne { 14 | 15 | } 16 | 17 | public class InnerTwo { 18 | 19 | } 20 | 21 | public class InnerThree { 22 | 23 | } 24 | 25 | public class InnerFour { 26 | 27 | } 28 | 29 | @TestAnnotation1 30 | @TestAnnotation2 31 | @TestAnnotation3 32 | @TestAnnotation4 33 | @TestAnnotation5 34 | @TestAnnotation6 35 | @TestAnnotation7 36 | @TestAnnotation8 37 | public Integer field1; 38 | 39 | public Integer field2; 40 | public Integer field3; 41 | public Integer field4; 42 | 43 | public ClassTestHelper() { 44 | 45 | } 46 | 47 | public ClassTestHelper(Integer f1) { 48 | field1 = f1; 49 | } 50 | 51 | public ClassTestHelper(Integer f1, Integer f2) { 52 | field1 = f1; 53 | field2 = f2; 54 | } 55 | 56 | public ClassTestHelper(Integer f1, Integer f2, Integer f3) { 57 | field1 = f1; 58 | field2 = f2; 59 | field3 = f3; 60 | } 61 | 62 | public ClassTestHelper(Integer f1, Integer f2, Integer f3, Integer f4) { 63 | field1 = f1; 64 | field2 = f2; 65 | field3 = f3; 66 | field4 = f4; 67 | } 68 | 69 | @TestAnnotation1 70 | @TestAnnotation2 71 | @TestAnnotation3 72 | @TestAnnotation4 73 | @TestAnnotation5 74 | @TestAnnotation6 75 | @TestAnnotation7 76 | @TestAnnotation8 77 | public int m1(@TestAnnotation1 @TestAnnotation2 @TestAnnotation3 @TestAnnotation4 Integer param) 78 | throws NullPointerException, ArithmeticException, ArrayIndexOutOfBoundsException, ClassCastException, Exception { 79 | return param; 80 | } 81 | 82 | public int m2() { 83 | return 2; 84 | } 85 | 86 | public int m3() { 87 | return 3; 88 | } 89 | 90 | public int m4() { 91 | return 4; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/IdentityHashMapTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import java.util.Collections; 33 | import java.util.IdentityHashMap; 34 | import java.util.Iterator; 35 | 36 | import org.junit.Test; 37 | 38 | public class IdentityHashMapTest { 39 | 40 | // Author: Chih-Fu Lai (2025) 41 | // Added test coverage for IdentityHashMap.removeAll iterator behavior 42 | @Test 43 | public void testRemoveAllArrayIndexOutOfBounds() { 44 | for (int i = 0; i < 999; i++) { 45 | IdentityHashMap map = new IdentityHashMap<>(4); 46 | 47 | Object k1 = new Object(); 48 | Object k2 = new Object(); 49 | Object k3 = new Object(); 50 | 51 | map.put(k1, 1); 52 | map.put(k2, 2); 53 | map.put(k3, 3); 54 | 55 | map.keySet().removeAll(Collections.singleton(k2)); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/FieldTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import static org.hamcrest.core.IsEqual.equalTo; 33 | import static org.hamcrest.core.IsNot.not; 34 | import static org.junit.Assert.assertThat; 35 | 36 | import java.lang.reflect.Field; 37 | 38 | import org.junit.Before; 39 | import org.junit.Test; 40 | 41 | public class FieldTest { 42 | private Field myField; 43 | 44 | @Before 45 | public void setUp() throws NoSuchFieldException { 46 | Class clazz = ClassTestHelper.class; 47 | myField = clazz.getField("field1"); 48 | } 49 | 50 | @Test 51 | public void getDeclaredAnnotationsTest() { 52 | assertThat(myField.getDeclaredAnnotations(), not(equalTo(myField.getDeclaredAnnotations()))); 53 | } 54 | 55 | @Test 56 | public void getAnnotationsTest() { 57 | assertThat(myField.getAnnotations(), not(equalTo(myField.getAnnotations()))); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/excluded-groups-it/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | nondex.plugin.it 7 | excluded-groups-it 8 | 1.0-SNAPSHOT 9 | pom 10 | IT verifying excluded groups 11 | 12 | 13 | UTF-8 14 | 15 | 16 | 17 | module1 18 | module2 19 | 20 | 21 | 22 | 23 | 24 | org.apache.maven.plugins 25 | maven-compiler-plugin 26 | 3.8.1 27 | 28 | 1.8 29 | 1.8 30 | 31 | 32 | 33 | @project.groupId@ 34 | nondex-maven-plugin 35 | @project.version@ 36 | 37 | 38 | org.apache.maven.plugins 39 | maven-surefire-plugin 40 | 2.22.2 41 | 42 | 2 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | junit 51 | junit 52 | 4.13.2 53 | test 54 | 55 | 56 | @project.groupId@ 57 | nondex-annotations 58 | @project.version@ 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /nondex-common/src/main/java/edu/illinois/nondex/common/Logger.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.common; 31 | 32 | import java.io.PrintStream; 33 | 34 | public class Logger { 35 | 36 | private static final Logger INSTANCE = new Logger(); 37 | private PrintStream out = System.out; 38 | private Level level = Level.CONFIG; 39 | 40 | public void setLoggingLevel(Level level) { 41 | this.level = level; 42 | } 43 | 44 | public Level getLoggingLevel() { 45 | return this.level; 46 | } 47 | 48 | public static Logger getGlobal() { 49 | return Logger.INSTANCE; 50 | } 51 | 52 | public void log(Level lev, String msg, Throwable thr) { 53 | if (lev.intValue() < this.level.intValue()) { 54 | return; 55 | } 56 | this.out.println(lev.toString() + ": " + msg); 57 | this.out.println(thr); 58 | } 59 | 60 | public void log(Level lev, String msg) { 61 | if (lev.intValue() < this.level.intValue()) { 62 | return; 63 | } 64 | this.out.println(lev.toString() + ": " + msg); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/DateFormatSymbolsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import static org.hamcrest.core.IsEqual.equalTo; 33 | import static org.hamcrest.core.IsNot.not; 34 | import static org.junit.Assert.assertThat; 35 | import static org.junit.Assert.fail; 36 | 37 | import java.text.DateFormatSymbols; 38 | import java.util.Arrays; 39 | 40 | import org.junit.Test; 41 | 42 | public class DateFormatSymbolsTest { 43 | @Test 44 | public void getAvailableLocalesTest() { 45 | assertThat(DateFormatSymbols.getAvailableLocales(), not(equalTo(DateFormatSymbols.getAvailableLocales()))); 46 | } 47 | 48 | @Test 49 | public void getZoneStringsTest() { 50 | 51 | DateFormatSymbols dfs = new DateFormatSymbols(); 52 | String[][] result = dfs.getZoneStrings(); 53 | for (int i = 0; i < 10; i++) { 54 | if (!Arrays.deepEquals(result, dfs.getZoneStrings())) { 55 | return; 56 | } 57 | } 58 | fail("getZoneStrings did not extend in 10 tries; something is likely fishy."); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /nondex-core/src/main/java/java/util/HashIteratorShuffler.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package java.util; 31 | 32 | import java.util.HashMap.HashIterator; 33 | import java.util.HashMap.Node; 34 | 35 | public class HashIteratorShuffler { 36 | private Iterator> iter; 37 | private HashIterator hashIter; 38 | 39 | public HashIteratorShuffler(HashIterator hi) { 40 | hashIter = hi; 41 | List> oneOrder = new ArrayList<>(); 42 | while (hashIter.original_hasNext()) { 43 | oneOrder.add(hashIter.original_nextNode()); 44 | } 45 | oneOrder = edu.illinois.nondex.shuffling.ControlNondeterminism.shuffle(oneOrder); 46 | hashIter.current = null; 47 | iter = oneOrder.iterator(); 48 | } 49 | 50 | public Node nextNode(int modCount) { 51 | if (modCount != hashIter.expectedModCount) { 52 | throw new ConcurrentModificationException(); 53 | } 54 | hashIter.current = iter.next(); 55 | return hashIter.current; 56 | } 57 | 58 | public boolean hasNext() { 59 | return this.iter.hasNext(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/test/java/edu/illinois/nondex/plugin/CleanSurefireExecutionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.plugin; 31 | 32 | import static org.junit.Assert.assertEquals; 33 | 34 | import org.junit.Test; 35 | 36 | public class CleanSurefireExecutionTest { 37 | 38 | @Test 39 | public void testReplacementWorks() { 40 | String result = CleanSurefireExecution.sanitizeAndRemoveEnvironmentVars("${somestuff}"); 41 | assertEquals("", result); 42 | } 43 | 44 | @Test 45 | public void testReplacementMultiple() { 46 | String result = CleanSurefireExecution.sanitizeAndRemoveEnvironmentVars("${some-stuff} ${some.MoreStuff} \n${a}"); 47 | assertEquals("", result); 48 | } 49 | 50 | @Test 51 | public void testNothingChanges() { 52 | String result = CleanSurefireExecution.sanitizeAndRemoveEnvironmentVars("several$ }things{ in he}re"); 53 | assertEquals("several$ }things{ in he}re", result); 54 | } 55 | 56 | @Test 57 | public void testMixed() { 58 | String result = CleanSurefireExecution.sanitizeAndRemoveEnvironmentVars("${somestuff} and other stuff ${and}}"); 59 | assertEquals("and other stuff }", result); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/DelayQueueTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import static org.hamcrest.core.IsEqual.equalTo; 4 | import static org.hamcrest.core.IsNot.not; 5 | import static org.junit.Assert.assertThat; 6 | 7 | import java.util.ArrayList; 8 | import java.util.Iterator; 9 | import java.util.List; 10 | import java.util.concurrent.DelayQueue; 11 | import java.util.concurrent.Delayed; 12 | import java.util.concurrent.TimeUnit; 13 | 14 | import org.junit.Before; 15 | import org.junit.Test; 16 | 17 | public class DelayQueueTest { 18 | private DelayQueue prq; 19 | 20 | @Before 21 | public void setUp() { 22 | prq = new DelayQueue(); 23 | for (int ind = 0; ind < 10; ind++) { 24 | prq.add(new DelayedInt(ind)); 25 | } 26 | } 27 | 28 | @Test 29 | public void iteratorTest() { 30 | Iterator it1 = prq.iterator(); 31 | List list1 = new ArrayList<>(); 32 | 33 | while (it1.hasNext()) { 34 | list1.add(it1.next().get()); 35 | } 36 | 37 | Iterator it2 = prq.iterator(); 38 | List list2 = new ArrayList<>(); 39 | 40 | while (it2.hasNext()) { 41 | list2.add(it2.next().get()); 42 | } 43 | 44 | assertThat(list1.size(), equalTo(list2.size())); 45 | assertThat(list1, not(equalTo(list2))); 46 | } 47 | 48 | @Test 49 | public void toArrayTest() { 50 | assertThat(prq.toArray(), not(equalTo(prq.toArray()))); 51 | } 52 | 53 | @Test 54 | public void toArrayArgTest() { 55 | DelayedInt[] list1 = new DelayedInt[10]; 56 | DelayedInt[] list2 = new DelayedInt[10]; 57 | 58 | prq.toArray(list1); 59 | prq.toArray(list2); 60 | 61 | assertThat(list1, not(equalTo(list2))); 62 | } 63 | 64 | private class DelayedInt implements Delayed { 65 | private int value; 66 | 67 | public DelayedInt(int val) { 68 | value = val; 69 | } 70 | 71 | public int get() { 72 | return value; 73 | } 74 | 75 | public String toString() { 76 | return Integer.toString(value); 77 | } 78 | 79 | @Override 80 | public long getDelay(TimeUnit timeUnit) { 81 | return 0; 82 | } 83 | 84 | @Override 85 | public int compareTo(Delayed delayed) { 86 | return 0; 87 | } 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/MethodTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import static org.hamcrest.core.IsEqual.equalTo; 33 | import static org.hamcrest.core.IsNot.not; 34 | import static org.junit.Assert.assertThat; 35 | 36 | import java.lang.reflect.Method; 37 | 38 | import org.junit.Before; 39 | import org.junit.Test; 40 | 41 | public class MethodTest { 42 | private Method myMethod; 43 | 44 | @Before 45 | public void setUp() throws NoSuchMethodException { 46 | Class clazz = ClassTestHelper.class; 47 | myMethod = clazz.getMethod("m1", Integer.class); 48 | } 49 | 50 | @Test 51 | public void getDeclaredAnnotationsTest() { 52 | assertThat(myMethod.getDeclaredAnnotations(), not(equalTo(myMethod.getDeclaredAnnotations()))); 53 | } 54 | 55 | @Test 56 | public void getExceptionTypesTest() { 57 | assertThat(myMethod.getExceptionTypes(), not(equalTo(myMethod.getExceptionTypes()))); 58 | } 59 | 60 | @Test 61 | public void getGenericExceptionTypesTest() { 62 | assertThat(myMethod.getGenericExceptionTypes(), not(equalTo(myMethod.getGenericExceptionTypes()))); 63 | } 64 | 65 | @Test 66 | public void getParamaterAnnotationsTest() { 67 | assertThat(myMethod.getParameterAnnotations(), not(equalTo(myMethod.getParameterAnnotations()))); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /nondex-common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | edu.illinois 6 | nondex 7 | 2.2.5-SNAPSHOT 8 | 9 | 10 | nondex-common 11 | jar 12 | nondex-common 13 | 14 | 15 | 16 | 17 | 18 | src/main/java/edu/illinois/nondex/common 19 | true 20 | 21 | 22 | 23 | 24 | org.apache.maven.plugins 25 | maven-checkstyle-plugin 26 | 3.1.1 27 | 28 | checkstyle.xml 29 | UTF-8 30 | true 31 | true 32 | true 33 | true 34 | false 35 | 36 | 37 | 38 | com.puppycrawl.tools 39 | checkstyle 40 | 8.29 41 | 42 | 43 | 44 | 45 | validate 46 | validate 47 | 48 | check 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | java9+ 59 | 60 | [9,) 61 | 62 | 63 | 64 | 65 | org.apache.maven.plugins 66 | maven-javadoc-plugin 67 | 68 | --add-exports java.base/jdk.internal.misc=ALL-UNNAMED 69 | 70 | 71 | 72 | org.apache.maven.plugins 73 | maven-compiler-plugin 74 | 75 | 76 | --add-exports 77 | java.base/jdk.internal.misc=ALL-UNNAMED 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/AbstractCollectionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import edu.illinois.nondex.shuffling.ControlNondeterminism; 33 | 34 | import org.junit.Assert; 35 | 36 | public abstract class AbstractCollectionTest { 37 | 38 | protected abstract T createResizedDS(); 39 | 40 | protected abstract T createResizedDS(int start, int maxSize); 41 | 42 | protected abstract T addRemoveDS(T ds); 43 | 44 | protected void assertParameterized(T ds, Object derived, String str) { 45 | switch (ControlNondeterminism.getConfiguration().mode) { 46 | case FULL: 47 | String tempStr = derived.toString(); 48 | Assert.assertNotEquals("FULL is improperly running", str, tempStr); 49 | this.assertEqualstUnordered("Does not match permutation", str, tempStr); 50 | break; 51 | case ONE: 52 | Assert.assertEquals("ONE is improperly running", str, derived.toString()); 53 | break; 54 | default: 55 | break; 56 | } 57 | } 58 | 59 | protected void assertEqualstUnordered(String msg, String expected, String actual) { 60 | Assert.assertEquals(msg + ": " + expected + " =/= " + actual, expected.length(), actual.length()); 61 | String trimmed = expected.substring(1, expected.length() - 1); 62 | String[] elems = trimmed.split(","); 63 | // TODO(gyori): fix and make this more robust. It does not check duplicates, substrings, etc. 64 | for (int i = 0; i < elems.length; i++) { 65 | elems[i] = elems[i].trim(); 66 | Assert.assertTrue(msg + ": " + trimmed + " =/= " + actual, actual.contains(elems[i])); 67 | } 68 | 69 | 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/main/java/edu/illinois/nondex/plugin/CleanMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.plugin; 31 | 32 | import java.io.File; 33 | import java.nio.file.Path; 34 | import java.nio.file.Paths; 35 | 36 | import edu.illinois.nondex.common.ConfigurationDefaults; 37 | 38 | import org.apache.maven.plugin.AbstractMojo; 39 | import org.apache.maven.plugin.MojoExecutionException; 40 | import org.apache.maven.plugins.annotations.Mojo; 41 | import org.apache.maven.plugins.annotations.Parameter; 42 | 43 | /** 44 | * Removes NonDex plugin artifacts (i.e. the ".nondex" directories in each 45 | * module root) as well as the NonDex jar. 46 | */ 47 | @Mojo(name = "clean", requiresDirectInvocation = true) 48 | public class CleanMojo extends AbstractMojo { 49 | 50 | @Parameter(defaultValue = "${basedir}") 51 | protected File baseDir; 52 | 53 | public void execute() throws MojoExecutionException { 54 | Path nondexArtifactsPath = Paths.get(this.baseDir.getAbsolutePath(), 55 | ConfigurationDefaults.DEFAULT_NONDEX_DIR); 56 | Path nondexJarPath = Paths.get(this.baseDir.getAbsolutePath(), 57 | ConfigurationDefaults.DEFAULT_NONDEX_JAR_DIR, 58 | ConfigurationDefaults.INSTRUMENTATION_JAR); 59 | 60 | File artifactsDir = nondexArtifactsPath.toFile(); 61 | File nondexJar = nondexJarPath.toFile(); 62 | 63 | if (nondexJar.exists()) { 64 | delete(nondexJar); 65 | } 66 | 67 | if (artifactsDir.exists()) { 68 | delete(artifactsDir); 69 | } 70 | } 71 | 72 | public void delete(File file) { 73 | if (file.isDirectory()) { 74 | for (File childFile : file.listFiles()) { 75 | delete(childFile); 76 | } 77 | } 78 | file.delete(); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/settings-property-argline-it/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | nondex.plugin.it 7 | settings-property-argline-it 8 | 1.0-SNAPSHOT 9 | IT verifying that settings.* properties in argLine are preserved while other unresolved properties are removed. 10 | 11 | 12 | UTF-8 13 | 5.14.2 14 | 15 | 16 | 17 | 18 | 19 | org.apache.maven.plugins 20 | maven-compiler-plugin 21 | 3.8.1 22 | 23 | 1.8 24 | 1.8 25 | 26 | 27 | 28 | @project.groupId@ 29 | @project.artifactId@ 30 | @project.version@ 31 | 32 | 33 | org.apache.maven.plugins 34 | maven-surefire-plugin 35 | 2.22.2 36 | 37 | 40 | --add-opens java.base/java.net=ALL-UNNAMED 41 | --add-opens java.base/java.util=ALL-UNNAMED 42 | -javaagent:"${settings.localRepository}/org/mockito/mockito-core/${mockito.version}/mockito-core-${mockito.version}.jar" 43 | -Xshare:off 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | junit 52 | junit 53 | 4.13.2 54 | test 55 | 56 | 57 | @project.groupId@ 58 | nondex-common 59 | @project.version@ 60 | 61 | 62 | org.mockito 63 | mockito-core 64 | ${mockito.version} 65 | test 66 | 67 | 68 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/HashSetTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import java.util.HashSet; 33 | import java.util.Iterator; 34 | import java.util.Set; 35 | 36 | import org.junit.Assert; 37 | import org.junit.Test; 38 | 39 | public class HashSetTest extends AbstractCollectionTest> { 40 | 41 | @Override 42 | protected Set createResizedDS() { 43 | return this.createResizedDS(0, 103); 44 | } 45 | 46 | @Override 47 | protected Set createResizedDS(int start, int maxSize) { 48 | Set set = new HashSet<>(); 49 | 50 | for (int i = start; i < maxSize; i++) { 51 | set.add(i); 52 | } 53 | 54 | for (int i = start + 10; i < maxSize; i++) { 55 | set.remove(i); 56 | } 57 | 58 | Assert.assertEquals("the size should be 10", 10, set.size()); 59 | 60 | return set; 61 | } 62 | 63 | @Override 64 | protected Set addRemoveDS(Set ds) { 65 | ds.add(27); 66 | ds.remove(27); 67 | return ds; 68 | } 69 | 70 | 71 | @Test 72 | public void testHashSet() { 73 | Set set = this.createResizedDS(0, 100000); 74 | Iterator it = set.iterator(); 75 | it.next(); 76 | it.next(); 77 | it.remove(); 78 | it.next(); 79 | Assert.assertEquals("the size should be 9 now", 9, set.size()); 80 | // this is the natural order; 2 should be removed by the iterator remove above 81 | Assert.assertNotEquals("You are likely running an unchanged JVM", 82 | "[0, 2, 3, 4, 5, 6, 7, 8, 9]", set.toString()); 83 | } 84 | 85 | @Test 86 | public void testHashSetParametrized() { 87 | Set set = this.createResizedDS(0, 100000); 88 | this.assertParameterized(set, set, set.toString()); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if %ERRORLEVEL% equ 0 goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if %ERRORLEVEL% equ 0 goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | set EXIT_CODE=%ERRORLEVEL% 84 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 85 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 86 | exit /b %EXIT_CODE% 87 | 88 | :mainEnd 89 | if "%OS%"=="Windows_NT" endlocal 90 | 91 | :omega 92 | -------------------------------------------------------------------------------- /nondex-instrumentation/src/main/java/edu/illinois/nondex/instr/CVFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.instr; 31 | 32 | import java.security.NoSuchAlgorithmException; 33 | 34 | import edu.illinois.nondex.common.Level; 35 | import edu.illinois.nondex.common.Logger; 36 | 37 | import org.objectweb.asm.ClassVisitor; 38 | 39 | public class CVFactory { 40 | public static ClassVisitor construct(ClassVisitor cv, String clzToInstrument) 41 | throws NoSuchAlgorithmException { 42 | if (clzToInstrument.equals(Instrumenter.concurrentHashMapName)) { 43 | return new ConcurrentHashMapShufflingAdder(cv); 44 | } else if (clzToInstrument.equals(Instrumenter.hashMapName)) { 45 | if (Instrumenter.hasClassEntry(Instrumenter.hashMapNodeName)) { 46 | return new HashMapShufflingAdder(cv, "Node"); 47 | } else if (Instrumenter.hasClassEntry(Instrumenter.hashMapEntryName)) { 48 | return new HashMapShufflingAdder(cv, "Entry"); 49 | } 50 | } else if (clzToInstrument.equals(Instrumenter.weakHashMapName)) { 51 | return new WeakHashMapShufflingAdder(cv); 52 | } else if (clzToInstrument.equals(Instrumenter.identityHashMapName)) { 53 | return new IdentityHashMapShufflingAdder(cv); 54 | } else if (clzToInstrument.equals(Instrumenter.methodName)) { 55 | return new MethodShufflingAdder(cv); 56 | } else if (clzToInstrument.equals(Instrumenter.priorityQueueName)) { 57 | return new PriorityQueueShufflingAdder(cv); 58 | } else if (clzToInstrument.equals(Instrumenter.priorityBlockingQueueName)) { 59 | return new PriorityBlockingQueueShufflingAdder(cv); 60 | } else { 61 | Logger.getGlobal().log(Level.CONFIG, "Trying to construct CV for " + clzToInstrument); 62 | throw new NoSuchAlgorithmException(); 63 | } 64 | return null; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /nondex-maven-plugin/src/it/multiple-surefire-executions/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | nondex.plugin.it 7 | simple-it 8 | 1.0-SNAPSHOT 9 | 10 | A simple IT verifying the basic use case. 11 | 12 | 13 | UTF-8 14 | 15 | 16 | 17 | 18 | 19 | org.apache.maven.plugins 20 | maven-compiler-plugin 21 | 3.8.1 22 | 23 | 1.8 24 | 1.8 25 | 26 | 27 | 28 | @project.groupId@ 29 | @project.artifactId@ 30 | @project.version@ 31 | 32 | 33 | org.apache.maven.plugins 34 | maven-surefire-plugin 35 | 2.22.2 36 | 37 | 2 38 | 39 | 40 | 1 41 | 42 | 43 | 44 | 45 | default-test 46 | 47 | true 48 | 49 | 50 | 51 | test-execution-1 52 | 53 | test 54 | 55 | 56 | 57 | 58 | 2 59 | 60 | 61 | **/AppExec1Test.java 62 | 63 | 64 | 65 | 66 | test-execution-2 67 | 68 | test 69 | 70 | 71 | 72 | 73 | **/AppExec2Test.java 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | junit 85 | junit 86 | 4.13.2 87 | test 88 | 89 | 90 | @project.groupId@ 91 | nondex-common 92 | @project.version@ 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /nondex-instrumentation/src/test/java/edu/illinois/nondex/instr/InstrumenterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.instr; 31 | 32 | import static org.hamcrest.CoreMatchers.containsString; 33 | import static org.junit.Assert.assertThat; 34 | import static org.junit.Assert.assertTrue; 35 | import static org.junit.Assert.fail; 36 | 37 | import java.io.IOException; 38 | import java.nio.file.Files; 39 | import java.nio.file.LinkOption; 40 | import java.nio.file.Path; 41 | import java.nio.file.Paths; 42 | import java.security.NoSuchAlgorithmException; 43 | 44 | import edu.illinois.nondex.common.Utils; 45 | 46 | import org.junit.After; 47 | import org.junit.Assume; 48 | import org.junit.Before; 49 | import org.junit.Test; 50 | 51 | public class InstrumenterTest { 52 | 53 | private Path outJar = Paths.get("resources", "emptyOut.jar"); 54 | 55 | @Before 56 | public void setUp() throws IOException { 57 | Files.deleteIfExists(outJar); 58 | } 59 | 60 | @After 61 | public void tearDown() throws IOException { 62 | Files.deleteIfExists(outJar); 63 | } 64 | 65 | @Test 66 | public void emptyZipTest() throws NoSuchAlgorithmException, IOException { 67 | Assume.assumeTrue(Utils.checkJDKBefore8()); 68 | Instrumenter.instrument(Paths.get("resources", "empty.jar").toString(), 69 | outJar.toString()); 70 | assertTrue(Files.exists(outJar, LinkOption.NOFOLLOW_LINKS)); 71 | } 72 | 73 | @Test 74 | public void nonexistantZipTest() throws NoSuchAlgorithmException { 75 | Assume.assumeTrue(Utils.checkJDKBefore8()); 76 | try { 77 | Instrumenter.instrument(Paths.get("resources", "doesnotexist.jar").toString(), 78 | Paths.get("resources", "doesnotexistOut.jar").toString()); 79 | fail("Expected an IOException to be thrown"); 80 | } catch (IOException exc) { 81 | assertThat(exc.getMessage(), 82 | containsString(Paths.get("resources", "doesnotexist.jar").toString())); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/ClassTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import static org.hamcrest.core.IsEqual.equalTo; 33 | import static org.hamcrest.core.IsNot.not; 34 | import static org.junit.Assert.assertThat; 35 | 36 | import org.junit.Before; 37 | import org.junit.Test; 38 | 39 | public class ClassTest { 40 | 41 | private Class clazz; 42 | 43 | @Before 44 | public void setUp() { 45 | // TODO: pick a class with annotations and test: 46 | // clazz.getAnnotations(); 47 | // clazz.getDeclaredAnnotations(); 48 | clazz = ClassTestHelper.class; 49 | } 50 | 51 | @Test 52 | public void getClassesTest() { 53 | assertThat(clazz.getClasses(), not(equalTo(clazz.getClasses()))); 54 | } 55 | 56 | @Test 57 | public void getFieldsTest() { 58 | assertThat(clazz.getFields(), not(equalTo(clazz.getFields()))); 59 | } 60 | 61 | @Test 62 | public void getDeclaredFieldsTest() { 63 | assertThat(clazz.getDeclaredFields(), not(equalTo(clazz.getDeclaredFields()))); 64 | } 65 | 66 | @Test 67 | public void getConstructorsTest() throws NoSuchMethodException { 68 | assertThat(clazz.getConstructors(), not(equalTo(clazz.getConstructors()))); 69 | } 70 | 71 | @Test 72 | public void getDeclaredConstructorsTest() { 73 | assertThat(clazz.getDeclaredConstructors(), not(equalTo(clazz.getDeclaredConstructors()))); 74 | } 75 | 76 | @Test 77 | public void getMethodsTest() { 78 | assertThat(clazz.getMethods(), not(equalTo(clazz.getMethods()))); 79 | } 80 | 81 | @Test 82 | public void getDeclaredMethodsTest() { 83 | assertThat(clazz.getDeclaredMethods(), not(equalTo(clazz.getDeclaredMethods()))); 84 | } 85 | 86 | @Test 87 | public void getAnnotationsTest() { 88 | assertThat(clazz.getAnnotations(), not(equalTo(clazz.getAnnotations()))); 89 | } 90 | 91 | @Test 92 | public void getDeclaredAnnotationsTest() { 93 | assertThat(clazz.getDeclaredAnnotations(), not(equalTo(clazz.getDeclaredAnnotations()))); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/ClassTestHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | @TestAnnotation1 33 | @TestAnnotation2 34 | @TestAnnotation3 35 | @TestAnnotation4 36 | @TestAnnotation5 37 | @TestAnnotation6 38 | @TestAnnotation7 39 | @TestAnnotation8 40 | public class ClassTestHelper { 41 | 42 | public class InnerOne { 43 | 44 | } 45 | 46 | public class InnerTwo { 47 | 48 | } 49 | 50 | public class InnerThree { 51 | 52 | } 53 | 54 | public class InnerFour { 55 | 56 | } 57 | 58 | @TestAnnotation1 59 | @TestAnnotation2 60 | @TestAnnotation3 61 | @TestAnnotation4 62 | @TestAnnotation5 63 | @TestAnnotation6 64 | @TestAnnotation7 65 | @TestAnnotation8 66 | public Integer field1; 67 | 68 | public Integer field2; 69 | public Integer field3; 70 | public Integer field4; 71 | 72 | public ClassTestHelper() { 73 | 74 | } 75 | 76 | public ClassTestHelper(Integer f1) { 77 | field1 = f1; 78 | } 79 | 80 | public ClassTestHelper(Integer f1, Integer f2) { 81 | field1 = f1; 82 | field2 = f2; 83 | } 84 | 85 | public ClassTestHelper(Integer f1, Integer f2, Integer f3) { 86 | field1 = f1; 87 | field2 = f2; 88 | field3 = f3; 89 | } 90 | 91 | public ClassTestHelper(Integer f1, Integer f2, Integer f3, Integer f4) { 92 | field1 = f1; 93 | field2 = f2; 94 | field3 = f3; 95 | field4 = f4; 96 | } 97 | 98 | @TestAnnotation1 99 | @TestAnnotation2 100 | @TestAnnotation3 101 | @TestAnnotation4 102 | @TestAnnotation5 103 | @TestAnnotation6 104 | @TestAnnotation7 105 | @TestAnnotation8 106 | public int m1(@TestAnnotation1 @TestAnnotation2 @TestAnnotation3 @TestAnnotation4 Integer param) 107 | throws NullPointerException, ArithmeticException, ArrayIndexOutOfBoundsException, ClassCastException, Exception { 108 | return param; 109 | } 110 | 111 | public int m2() { 112 | return 2; 113 | } 114 | 115 | public int m3() { 116 | return 3; 117 | } 118 | 119 | public int m4() { 120 | return 4; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/QueueTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import static org.hamcrest.core.IsEqual.equalTo; 4 | import static org.hamcrest.core.IsNot.not; 5 | import static org.junit.Assert.assertEquals; 6 | import static org.junit.Assert.assertFalse; 7 | import static org.junit.Assert.assertThat; 8 | import static org.junit.Assert.assertTrue; 9 | 10 | import java.util.AbstractQueue; 11 | import java.util.Iterator; 12 | import java.util.NoSuchElementException; 13 | import java.util.PriorityQueue; 14 | import java.util.concurrent.PriorityBlockingQueue; 15 | 16 | import org.junit.Before; 17 | import org.junit.Test; 18 | import org.junit.runner.RunWith; 19 | import org.junit.runners.Parameterized; 20 | import org.junit.runners.Parameterized.Parameters; 21 | 22 | @RunWith(Parameterized.class) 23 | public class QueueTest { 24 | public AbstractQueue queue; 25 | 26 | public QueueTest(AbstractQueue queue) { 27 | this.queue = queue; 28 | } 29 | 30 | @Parameters 31 | public static Object[] data() { 32 | PriorityQueue prq = new PriorityQueue<>(); 33 | PriorityBlockingQueue prbq = new PriorityBlockingQueue<>(); 34 | return new Object[] {prq, prbq}; 35 | } 36 | 37 | @Before 38 | public void setUp() { 39 | queue.clear(); 40 | for (int ind = 0; ind < 10; ind++) { 41 | queue.add(ind); 42 | } 43 | } 44 | 45 | @Test 46 | public void testShuffling() { 47 | assertThat(queue.toString(), not(equalTo(queue.toString()))); 48 | } 49 | 50 | @Test(expected = IllegalStateException.class) 51 | public void testRemoveWhenEmpty() { 52 | queue.clear(); 53 | Iterator iter = queue.iterator(); 54 | iter.remove(); 55 | } 56 | 57 | @Test(expected = IllegalStateException.class) 58 | public void testRemoveWithoutCallingNextBefore() { 59 | Iterator iter = queue.iterator(); 60 | iter.remove(); 61 | } 62 | 63 | @Test(expected = NoSuchElementException.class) 64 | public void testNextWhenEmpty() { 65 | queue.clear(); 66 | Iterator iter = queue.iterator(); 67 | iter.next(); 68 | } 69 | 70 | @Test(expected = IllegalStateException.class) 71 | public void testRemoveTwice() { 72 | Iterator iter = queue.iterator(); 73 | Integer value = iter.next(); 74 | iter.remove(); 75 | assertFalse(queue.contains(value)); 76 | iter.remove(); 77 | } 78 | 79 | @Test 80 | public void testHasNextWhenEmpty() { 81 | queue.clear(); 82 | Iterator iter = queue.iterator(); 83 | assertFalse(iter.hasNext()); 84 | } 85 | 86 | @Test 87 | public void testRemove() { 88 | int size = queue.size(); 89 | Iterator iter = queue.iterator(); 90 | for (int i = 0; i < size; i++) { 91 | assertTrue(iter.hasNext()); 92 | Integer val = iter.next(); 93 | assertTrue(queue.contains(val)); 94 | iter.remove(); 95 | assertEquals(size - i - 1, queue.size()); 96 | assertFalse(queue.contains(val)); 97 | } 98 | assertEquals(0, queue.size()); 99 | } 100 | 101 | @Test 102 | public void testToArray() { 103 | assertThat(queue.toArray(), not(equalTo(queue.toArray()))); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /nondex-test/src/test/java/edu/illinois/nondex/core/DelayQueueTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.core; 31 | 32 | import static org.hamcrest.core.IsEqual.equalTo; 33 | import static org.hamcrest.core.IsNot.not; 34 | import static org.junit.Assert.assertThat; 35 | 36 | import java.util.ArrayList; 37 | import java.util.Iterator; 38 | import java.util.List; 39 | import java.util.concurrent.DelayQueue; 40 | import java.util.concurrent.Delayed; 41 | import java.util.concurrent.TimeUnit; 42 | 43 | import org.junit.Before; 44 | import org.junit.Test; 45 | 46 | public class DelayQueueTest { 47 | private DelayQueue prq; 48 | 49 | @Before 50 | public void setUp() { 51 | prq = new DelayQueue(); 52 | for (int ind = 0; ind < 10; ind++) { 53 | prq.add(new DelayedInt(ind)); 54 | } 55 | } 56 | 57 | @Test 58 | public void iteratorTest() { 59 | Iterator it1 = prq.iterator(); 60 | List list1 = new ArrayList<>(); 61 | 62 | while (it1.hasNext()) { 63 | list1.add(it1.next().get()); 64 | } 65 | 66 | Iterator it2 = prq.iterator(); 67 | List list2 = new ArrayList<>(); 68 | 69 | while (it2.hasNext()) { 70 | list2.add(it2.next().get()); 71 | } 72 | 73 | assertThat(list1.size(), equalTo(list2.size())); 74 | assertThat(list1, not(equalTo(list2))); 75 | } 76 | 77 | @Test 78 | public void toArrayTest() { 79 | assertThat(prq.toArray(), not(equalTo(prq.toArray()))); 80 | } 81 | 82 | @Test 83 | public void toArrayArgTest() { 84 | DelayedInt[] list1 = new DelayedInt[10]; 85 | DelayedInt[] list2 = new DelayedInt[10]; 86 | 87 | prq.toArray(list1); 88 | prq.toArray(list2); 89 | 90 | assertThat(list1, not(equalTo(list2))); 91 | } 92 | 93 | private class DelayedInt implements Delayed { 94 | private int value; 95 | 96 | public DelayedInt(int val) { 97 | value = val; 98 | } 99 | 100 | public int get() { 101 | return value; 102 | } 103 | 104 | public String toString() { 105 | return Integer.toString(value); 106 | } 107 | 108 | @Override 109 | public long getDelay(TimeUnit timeUnit) { 110 | return 0; 111 | } 112 | 113 | @Override 114 | public int compareTo(Delayed delayed) { 115 | return 0; 116 | } 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /nondex-instrumentation/src/main/java/edu/illinois/nondex/instr/ConcurrentHashMapShufflingAdder.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.instr; 31 | 32 | import org.objectweb.asm.ClassVisitor; 33 | import org.objectweb.asm.FieldVisitor; 34 | import org.objectweb.asm.Label; 35 | import org.objectweb.asm.MethodVisitor; 36 | import org.objectweb.asm.Opcodes; 37 | 38 | public class ConcurrentHashMapShufflingAdder extends ClassVisitor { 39 | 40 | public ConcurrentHashMapShufflingAdder(ClassVisitor ca) { 41 | super(Opcodes.ASM9, ca); 42 | } 43 | 44 | @Override 45 | public MethodVisitor visitMethod(int access, String name, String desc, 46 | String signature, String[] exceptions) { 47 | if ("".equals(name)) { 48 | return new MethodVisitor(Opcodes.ASM9, super.visitMethod(access, name, desc, signature, exceptions)) { 49 | @Override 50 | public void visitInsn(int opcode) { 51 | if (opcode == Opcodes.RETURN) { 52 | mv.visitVarInsn(Opcodes.ALOAD, 1); 53 | Label l0 = new Label(); 54 | mv.visitJumpInsn(Opcodes.IFNULL, l0); 55 | mv.visitVarInsn(Opcodes.ALOAD, 0); 56 | mv.visitVarInsn(Opcodes.ALOAD, 1); 57 | mv.visitVarInsn(Opcodes.ALOAD, 1); 58 | mv.visitInsn(Opcodes.ARRAYLENGTH); 59 | mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/util/Arrays", "copyOf", 60 | "([Ljava/lang/Object;I)[Ljava/lang/Object;", false); 61 | mv.visitMethodInsn(Opcodes.INVOKESTATIC, "edu/illinois/nondex/shuffling/ControlNondeterminism", 62 | "shuffle", "([Ljava/lang/Object;)[Ljava/lang/Object;", false); 63 | mv.visitTypeInsn(Opcodes.CHECKCAST, "[Ljava/util/concurrent/ConcurrentHashMap$Node;"); 64 | mv.visitFieldInsn(Opcodes.PUTFIELD, "java/util/concurrent/ConcurrentHashMap$Traverser", "tab", 65 | "[Ljava/util/concurrent/ConcurrentHashMap$Node;"); 66 | mv.visitLabel(l0); 67 | mv.visitFrame(Opcodes.F_FULL, 5, 68 | new Object[]{ 69 | "java/util/concurrent/ConcurrentHashMap$Traverser", 70 | "[Ljava/util/concurrent/ConcurrentHashMap$Node;", Opcodes.INTEGER, 71 | Opcodes.INTEGER, Opcodes.INTEGER}, 72 | 0, new Object[]{}); 73 | mv.visitInsn(Opcodes.RETURN); 74 | } 75 | super.visitInsn(opcode); 76 | } 77 | }; 78 | } 79 | 80 | return super.visitMethod(access, name, desc, signature, exceptions); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/main/java/edu/illinois/nondex/gradle/internal/NonDexTestProcessor.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.gradle.internal; 2 | 3 | import org.gradle.api.internal.tasks.testing.TestCompleteEvent; 4 | import org.gradle.api.internal.tasks.testing.TestDescriptorInternal; 5 | import org.gradle.api.internal.tasks.testing.TestResultProcessor; 6 | import org.gradle.api.internal.tasks.testing.TestStartEvent; 7 | import org.gradle.api.tasks.testing.TestOutputEvent; 8 | import org.gradle.api.tasks.testing.TestFailure; 9 | 10 | import java.lang.reflect.Method; 11 | import java.util.HashMap; 12 | import java.util.LinkedHashSet; 13 | import java.util.Map; 14 | import java.util.Set; 15 | 16 | public class NonDexTestProcessor implements TestResultProcessor { 17 | 18 | private final TestResultProcessor delegate; 19 | private Set failingTests = new LinkedHashSet<>(); 20 | private final Map activeDescriptorsById = new HashMap<>(); 21 | private Object rootTestDescriptorId; 22 | private boolean lastRun; 23 | private Method failureMethod; 24 | 25 | NonDexTestProcessor(TestResultProcessor delegate) { 26 | this.delegate = delegate; 27 | } 28 | 29 | @Override 30 | public void started(TestDescriptorInternal descriptor, TestStartEvent testStartEvent) { 31 | if (rootTestDescriptorId == null) { 32 | rootTestDescriptorId = descriptor.getId(); 33 | activeDescriptorsById.put(descriptor.getId(), descriptor); 34 | delegate.started(descriptor, testStartEvent); 35 | } else if (!descriptor.getId().equals(rootTestDescriptorId)) { 36 | activeDescriptorsById.put(descriptor.getId(), descriptor); 37 | delegate.started(descriptor, testStartEvent); 38 | } 39 | } 40 | 41 | @Override 42 | public void completed(Object testId, TestCompleteEvent testCompleteEvent) { 43 | if (testId.equals(rootTestDescriptorId)) { 44 | if (!lastRun) { 45 | return; 46 | } 47 | } else { 48 | activeDescriptorsById.remove(testId); 49 | } 50 | delegate.completed(testId, testCompleteEvent); 51 | } 52 | 53 | @Override 54 | public void output(Object testId, TestOutputEvent testOutputEvent) { 55 | delegate.output(testId, testOutputEvent); 56 | } 57 | 58 | @Override 59 | public void failure(Object testId, TestFailure result) { 60 | failure(testId); 61 | delegate.failure(testId, result); 62 | } 63 | 64 | @SuppressWarnings("unused") 65 | public void failure(Object testId, Throwable throwable) { 66 | // Gradle 7.6 changed the method signature from failure(Object, Throwable) to failure(Object, TestFailure). 67 | // To maintain compatibility with older versions, the original method needs to exist and needs to call failure() 68 | // on the delegate via reflection. 69 | failure(testId); 70 | try { 71 | Method failureMethod = lookupFailureMethod(); 72 | failureMethod.invoke(delegate, testId, throwable); 73 | } catch (ReflectiveOperationException e) { 74 | throw new RuntimeException(e); 75 | } 76 | } 77 | 78 | public void reset(boolean lastRun) { 79 | if (this.lastRun) { 80 | throw new IllegalStateException("processor has completed"); 81 | } 82 | this.lastRun = lastRun; 83 | this.activeDescriptorsById.clear(); 84 | this.failingTests = new LinkedHashSet<>(); 85 | } 86 | 87 | public Set getFailingTests() { 88 | return this.failingTests; 89 | } 90 | 91 | private Method lookupFailureMethod() throws ReflectiveOperationException { 92 | if (failureMethod == null) { 93 | failureMethod = delegate.getClass().getMethod("failure", Object.class, Throwable.class); 94 | } 95 | return failureMethod; 96 | } 97 | 98 | private void failure(Object testId) { 99 | final TestDescriptorInternal descriptor = activeDescriptorsById.get(testId); 100 | if (descriptor != null) { 101 | String className = descriptor.getClassName(); 102 | if (className != null) { 103 | String name = descriptor.getName(); 104 | failingTests.add(className + "." + name); 105 | } 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /nondex-gradle-plugin/plugin/src/functionalTest/resources/comprehensive-it/src/test/java/edu/illinois/nondex/functionalTest/MapTest.java: -------------------------------------------------------------------------------- 1 | package edu.illinois.nondex.functionalTest; 2 | 3 | import static org.hamcrest.core.IsEqual.equalTo; 4 | import static org.hamcrest.core.IsNot.not; 5 | import static org.junit.Assert.assertEquals; 6 | import static org.junit.Assert.assertFalse; 7 | import static org.junit.Assert.assertThat; 8 | import static org.junit.Assert.assertTrue; 9 | 10 | import java.util.ConcurrentModificationException; 11 | import java.util.HashMap; 12 | import java.util.IdentityHashMap; 13 | import java.util.Iterator; 14 | import java.util.Map; 15 | import java.util.Map.Entry; 16 | import java.util.NoSuchElementException; 17 | import java.util.WeakHashMap; 18 | import java.util.concurrent.ConcurrentHashMap; 19 | 20 | import org.junit.Before; 21 | import org.junit.Test; 22 | import org.junit.runner.RunWith; 23 | import org.junit.runners.Parameterized; 24 | import org.junit.runners.Parameterized.Parameters; 25 | 26 | @RunWith(Parameterized.class) 27 | public class MapTest { 28 | public Map map; 29 | 30 | public MapTest(Map map) { 31 | this.map = map; 32 | } 33 | 34 | @Parameters 35 | public static Object[] data() { 36 | HashMap hm = new HashMap<>(); 37 | WeakHashMap whm = new WeakHashMap<>(); 38 | IdentityHashMap ihm = new IdentityHashMap<>(); 39 | ConcurrentHashMap chm = new ConcurrentHashMap<>(); 40 | return new Object[] {hm, whm, ihm, chm}; 41 | } 42 | 43 | @Before 44 | public void setUp() { 45 | for (int i = 0; i < 10; i++) { 46 | ((Map) map).put(i, i); 47 | } 48 | } 49 | 50 | @Test(expected = IllegalStateException.class) 51 | public void testRemoveWhenEmpty() { 52 | map.clear(); 53 | Iterator> iter = map.entrySet().iterator(); 54 | iter.remove(); 55 | } 56 | 57 | @Test(expected = IllegalStateException.class) 58 | public void testRemoveWhenNotEmpty() { 59 | Iterator> iter = map.entrySet().iterator(); 60 | iter.remove(); 61 | } 62 | 63 | @Test(expected = IllegalStateException.class) 64 | public void testRemoveTwice() { 65 | int size = map.size(); 66 | Iterator> iter = map.entrySet().iterator(); 67 | assertTrue(iter.hasNext()); 68 | Entry entry = iter.next(); 69 | K key = entry.getKey(); 70 | assertTrue(map.entrySet().contains(entry)); 71 | iter.remove(); 72 | assertEquals(size - 1, map.size()); 73 | assertFalse(map.containsKey(key)); 74 | iter.remove(); 75 | } 76 | 77 | @Test(expected = NoSuchElementException.class) 78 | public void testNextWhenEmpty() { 79 | map.clear(); 80 | Iterator> iter = map.entrySet().iterator(); 81 | iter.next(); 82 | } 83 | 84 | @Test(expected = ConcurrentModificationException.class) 85 | public void testModify() { 86 | //Since concurrentHashMap should not throw the concurrentModificationException, 87 | //here we throw the exception in order to skip this test case for concurrentHashMap 88 | if (map instanceof ConcurrentHashMap) { 89 | throw new ConcurrentModificationException(); 90 | } 91 | 92 | Iterator> iter = map.entrySet().iterator(); 93 | map.clear(); 94 | iter.next(); 95 | } 96 | 97 | @Test 98 | public void testHasNextWhenEmpty() { 99 | map.clear(); 100 | Iterator> iter = map.entrySet().iterator(); 101 | assertFalse(iter.hasNext()); 102 | } 103 | 104 | @Test 105 | public void testRemove() { 106 | int size = map.size(); 107 | Iterator> iter = map.entrySet().iterator(); 108 | for (int i = 0; i < size; i++) { 109 | assertTrue(iter.hasNext()); 110 | Entry entry = iter.next(); 111 | K key = entry.getKey(); 112 | assertTrue(map.entrySet().contains(entry)); 113 | iter.remove(); 114 | assertEquals(size - i - 1, map.size()); 115 | assertFalse(map.containsKey(key)); 116 | } 117 | assertEquals(0, map.size()); 118 | } 119 | 120 | @Test 121 | public void testShuffling() { 122 | assertThat(map.toString(), not(equalTo(map.toString()))); 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /nondex-common/src/main/java/edu/illinois/nondex/common/Utils.java: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | Copyright (c) 2015 Alex Gyori 4 | Copyright (c) 2022 Kaiyao Ke 5 | Copyright (c) 2015 Owolabi Legunsen 6 | Copyright (c) 2015 Darko Marinov 7 | Copyright (c) 2015 August Shi 8 | 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software"), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | package edu.illinois.nondex.common; 31 | 32 | import java.io.FileInputStream; 33 | import java.io.IOException; 34 | import java.nio.file.Files; 35 | import java.nio.file.Path; 36 | import java.nio.file.Paths; 37 | import java.security.MessageDigest; 38 | import java.security.NoSuchAlgorithmException; 39 | import java.util.Properties; 40 | import javax.xml.bind.DatatypeConverter; 41 | 42 | public class Utils { 43 | 44 | public static Throwable linkException(Throwable nestedThrowable, Throwable pastSupressedException) { 45 | if (pastSupressedException == null) { 46 | return nestedThrowable; 47 | } 48 | if (nestedThrowable == null) { 49 | return pastSupressedException; 50 | } 51 | pastSupressedException.addSuppressed(nestedThrowable); 52 | return pastSupressedException; 53 | } 54 | 55 | public static Properties openPropertiesFrom(Path path) { 56 | Properties props = new Properties(); 57 | try { 58 | props.load(new FileInputStream(path.toFile())); 59 | } catch (IOException ioe) { 60 | Logger.getGlobal().log(Level.CONFIG, "Cannot open properties file!", ioe); 61 | } 62 | return props; 63 | } 64 | 65 | public static int computeIthSeed(int ithSeed, boolean rerun, int seed) { 66 | if (rerun) { 67 | return seed; 68 | } else { 69 | return seed + ithSeed * ConfigurationDefaults.SEED_FACTOR; 70 | } 71 | } 72 | 73 | public static String getFreshExecutionId() { 74 | try { 75 | // TODO(gyori): Fix to check that the id was not used before in the 76 | // .nondex (?) 77 | String id = DatatypeConverter.printBase64Binary( 78 | MessageDigest.getInstance("SHA-256").digest(Long.toString(System.currentTimeMillis()).getBytes())); 79 | id = id.replace("/", ""); 80 | id = id.replace("\\", ""); 81 | return id; 82 | } catch (NoSuchAlgorithmException nsae) { 83 | return "No_ID"; 84 | } 85 | } 86 | 87 | public static boolean checkJDKBefore8() { 88 | return System.getProperty("java.version").startsWith("1."); 89 | } 90 | 91 | public static boolean checkJDK8() { 92 | return System.getProperty("java.version").startsWith("1.8"); 93 | } 94 | 95 | public static Path getRtJarLocation() { 96 | String javaHome = System.getProperty("java.home"); 97 | if (javaHome == null) { 98 | Logger.getGlobal().log(Level.SEVERE, "JAVA_HOME is not set!"); 99 | throw new IllegalStateException("JAVA_HOME is not set!"); 100 | } 101 | 102 | 103 | Path pathToRt = Paths.get(javaHome, "jre", "lib", "rt.jar"); 104 | Logger.getGlobal().log(Level.FINE, pathToRt.toString()); 105 | if (Files.exists(pathToRt)) { 106 | return pathToRt; 107 | } 108 | 109 | pathToRt = Paths.get(javaHome, "lib", "rt.jar"); 110 | Logger.getGlobal().log(Level.FINE, pathToRt.toString()); 111 | if (Files.exists(pathToRt)) { 112 | return pathToRt; 113 | } 114 | 115 | return null; 116 | } 117 | } 118 | --------------------------------------------------------------------------------