Git Product home page Git Product logo

npefix's People

Contributors

andre15silva avatar bcornu avatar btellstrom avatar danglotb avatar dependabot[bot] avatar monperrus avatar surli avatar tdurieux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

npefix's Issues

safe mode for npefix

with

  • s3 skip statement
  • S4a return null
  • S4b return new (exp return constant)
  • S4c return existing
  • S4d return void

NPEFix not finding patches Bugs it should

This is related to eclipse/repairnator#1159

1.5 (uses fr.inria.spirals 0.7) 1.5.1 (uses fr.inria.gforge.spirals 0.7) 1.6-SNAPSHOT (master) (uses fr.inria.gforge.spirals 0.7)
collections-331 Compilation failure (unrelated to NPEFix) Compilation failure (unrelated to NPEFix) Compilation failure (unrelated to NPEFix)
collections-360 Compilation failure (unrelated to NPEFix) Compilation failure (unrelated to NPEFix) Compilation failure (unrelated to NPEFix)
felix-4960 Patch found Patch found Patch found
lang-304 Patch found Patch found JSONObject["executions"] not found.
lang-587 No diffs JSONObject["executions"] not found. JSONObject["executions"] not found.
lang-703 No diffs JSONObject["executions"] not found. JSONObject["executions"] not found.
math-290 No executions JSONObject["executions"] not found. JSONObject["executions"] not found.
math-305 No executions JSONObject["executions"] not found. JSONObject["executions"] not found.
math-369 No executions JSONObject["executions"] not found. JSONObject["executions"] not found.
math-988a Has diffs Patch found Patch found
math-988b No executions JSONObject["executions"] not found. JSONObject["executions"] not found.
math-1115 No executions JSONObject["executions"] not found. JSONObject["executions"] not found.
math-1117 No executions JSONObject["executions"] not found. JSONObject["executions"] not found.
pdfbox_2812 Could not resolve dependencies (unrelated to NPEFix) Could not resolve dependencies (unrelated to NPEFix) Could not resolve dependencies (unrelated to NPEFix)
pdfbox_2965 Has diffs Patch found Patch found
pdfbox_2995 Has diffs Patch found Patch found
sling_4982 Has diffs Patch found Patch found

NPEFix lost functionality over time as shown in the table below (left to right, oldest to latest):

Bug ID da6f155 60298ca d9b38d0 (v0.6) 1acca99 5992d4e (fr.inria.spirals v0.7)
felix-4960 Has diffs Has diffs java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException
lang304 Has diffs Has diffs Has diffs Has diffs Has diffs (but different)
lang587 Has diffs No diffs No diffs No diffs No diffs
lang703 Has diffs No diffs java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException
math290 Has diffs Has diffs java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException
math305 Has diffs Has diffs Has diffs Has diffs Has diffs (but different)
math369 Has diffs Has diffs Has diffs Has diffs Has diffs (but different)
pdfbox-2965 Has diffs Has diffs Has diffs Has diffs Has diffs (but different)
pdfbox-2995 Has diffs Has diffs (but different result) Has diffs (but different result) Has diffs (but different^2 result) Has diffs (but different^3 result)
sling-4982 Has diffs Has diffs Has diffs Has diffs Has diffs (but different)

To replicate configure the location of the dataset in src/main/resources/config.ini and run:

$ git checkout <commit-id>
$ mvn clean compile
$ mvn clean compile assembly:single
$ java -jar target/npefix-<version>-jar-with-dependencies.jar -p <bug-id>

My analysis:

  • There are several bugs, introduced over time, that were/are affecting the outputs.
  • I believe the executions bug in maven-repair is caused by the java.lang.reflect.InvocationTargetException exception.
  • There might be a couple more bugs in the middle of all the changes

This analysis is WIP, I'll continue digging tomorrow and try to fix the exception bug.

NPEFix doesn't find patches outside class files

NPEFix isn't able to produce textual patches for NPE's that could be fixed with changes in files outside of the class files in which the error occurs.

This is can be exemplified by https://github.com/andre15silva/failingProject/tree/npefix-scope, where changes to nopol_example_12.NopolExamplePackageFile.java or nopol_example_12.NopolExampleStackFile.java could fix the respective error, but only textual patches for nopol_example_12.NopolExample.java are produced.

This behavior can be found in eclipse/repairnator#1172 (comment), where the scope option influences what files are passed to NPEFix.

How to set seed, m2, and server port?

Hi,

According to the README.md file

  • (-k|--m2) <~/.m2> allows one to defined the path to the m2 directory
  • (-s|--seed) <randomSeed> allows one to define the seed of the random generator

however, these options are no longer available in version 0.8-SNAPSHOT. Is there any way to define these options (using the command line options) so that I don't have to configure a new config.ini every single time I wanna run npefix with a different seed?

--
Best,
Jose

Merge condition for more readable code

When you have twice the same condition in the same block it can be merged:

if (a!=null) {
  a.foo();
}
somethingeslse();
if (a!=null) {
  a.bar();
}

becomes

if (a!=null) {
  a.foo();
  somethingeslse();
  a.bar();
}

(bug found with Repairnator)

NpeFix generates an impossible patch, `return null` in a constructor

Good news, we have a patch in repairnator!

+++ /StreamDefinitionController.java
@@ -379,2 +379,5 @@
 
+			if (StreamDefinitionController.this.streamService == null) {
+				return null;
+			}
 			streamDeploymentStates = StreamDefinitionController.this.streamService

But this patch is impossible, because it is in a constructor, and return null is impossible in a constructor.

duplicate patch with Boolean.TRUE

Repairnator just gave two identical patch:

+            if (documentation.getId() == null) {
+                return Boolean.TRUE;
+            }

...

+            if (documentation.getId() == null) {
+                return true;
+            }

I suggest to remove Boolean.TRUE and Boolean.FALSE from the variables.

How NPEFix locates bugs?

Dear authors,
I read the code of NPEFix and donot find how it processes fault localization.
Does it use an external package or anything else?
Thanks~

Command line argument --test

Hi,

As defined in section Command line, --test is the "failing_test". Is this "failing_test" a test class or a test case/method? Does --test support more than one? If so, how? And, should failing and non-failing tests be provided, or just failing tests?

--
Best,
Jose

NPEFix on Closure throws a "spoon.SpoonException: Cannot create MethodTypingContext"

Dear NPEFix's maintainers,

I've been trying to run NPEFix on Closure from the Defects4J benchmark but no success so far. I'm getting a "spoon.SpoonException: Cannot create MethodTypingContext" exception for every single repair attempt.

Please find below a step-by-step to reproduce the exception.

$ java -version
java version "1.8.0_212"
Java(TM) SE Runtime Environment (build 1.8.0_212-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.212-b10, mixed mode)

$ mkdir "/tmp/npefix-on-d4j-closure"

Get NPEfix

$ cd "/tmp/npefix-on-d4j-closure"
$ git clone [email protected]:SpoonLabs/npefix.git # commit 80cfc38d4c3d5244c1a74c86e285193bb2670ea6
$ cd npefix
$ mvn install
$ export NPEFIX_JAR="/tmp/npefix-on-d4j-closure/npefix/target/npefix-0.8-SNAPSHOT-jar-with-dependencies.jar"

Get Defects4J

$ cd "/tmp/npefix-on-d4j-closure"
$ git clone [email protected]:rjust/defects4j.git # commit 3ec3d9242b922578d8cd6a045b5fa2a3c27bbdc9
$ cd defects4j
$ ./init.sh
$ export D4J_HOME="/private/tmp/npefix-on-d4j-closure/defects4j"

Checkout and compile Closure-1b

$ cd "/tmp/npefix-on-d4j-closure"
$ "$D4J_HOME/framework/bin/defects4j" checkout -p "Closure" -v "1b" -w "Closure-1b"
$ cd "Closure-1b"
$ "$D4J_HOME/framework/bin/defects4j" compile

Repair Closure-1b

$ cd "/tmp/npefix-on-d4j-closure/Closure-1b"
$ src_dir=$("$D4J_HOME/framework/bin/defects4j" export -p dir.src.classes)
$ test_dir=$("$D4J_HOME/framework/bin/defects4j" export -p dir.src.tests)
$ classpath=$("$D4J_HOME/framework/bin/defects4j" export -p cp.test)
$ java -jar "$NPEFIX_JAR" \
    --test "com.google.javascript.jscomp.CommandLineRunnerTest:com.google.javascript.jscomp.CompilerTest:com.google.javascript.jscomp.IntegrationTest:com.google.javascript.jscomp.OptimizeCallsTest:com.google.javascript.jscomp.RemoveUnusedVarsTest:com.google.javascript.jscomp.jsonml.SecureCompilerTest" \
    --iteration 100 \
    --complianceLevel 8 \
    --workingdirectory . \
    --source "$src_dir:$test_dir" \
    --classpath "$classpath" \
    --repairStrategy "fr.inria.spirals.npefix.main.all.DefaultRepairStrategy"

TernarySplitter  in 207ms
return (mismatchA == null) && (mismatchB == null)
return (mismatchA == null) && (mismatchB == null)
return (key != null) && (key.length() > 0)
Preconditions.checkState(references != null)
Preconditions.checkState(key != null)
Preconditions.checkState(id != null)
...
return registerCall != null
Preconditions.checkState(nameNode != null)
Preconditions.checkState(value != null)
Preconditions.checkState(value != null)
Preconditions.checkArgument(paths != null)
return properties.get(propertyName) != null
return getSlot(propertyName) != null
return properties.remove(name) != null
CheckNotNull  in 3321ms

Usage: java -jar npefix.jar
                          (-s|--source) source1:source2:...:sourceN  (-c|--classpath) <classpath> (-t|--test) test1:test2:...:testN  [--complianceLevel <complianceLevel>] [(-i|--iteration) <iteration>] [(-w|--workingdirectory) <workingdirectory>] [--repairStrategy <repairStrategy>]

  (-s|--source) source1:source2:...:sourceN
        Define the path to the source code of the project.

  (-c|--classpath) <classpath>
        Define the classpath of the project.

  (-t|--test) test1:test2:...:testN
        Define the tests of the project (both failing and passing),
        fully-qualified, separated with ':' (even if the classpath contains
        other tests, only those are considered.

  [--complianceLevel <complianceLevel>]
        The compliance level of the project. (default: 7)

  [(-i|--iteration) <iteration>]
        The maximum number of npefix iteration. (default: 100)

  [(-w|--workingdirectory) <workingdirectory>]
        Define the location where npefix will put its files. (default: .)

  [--repairStrategy <repairStrategy>]
        Define the repair strategy used by NPEFix. (default:
        fr.inria.spirals.npefix.main.all.DefaultRepairStrategy)

Exception in thread "main" spoon.SpoonException: Cannot create MethodTypingContext for method declared in different ClassTypingContext
	at spoon.support.visitor.MethodTypingContext.setMethod(MethodTypingContext.java:63)
	at spoon.support.visitor.ClassTypingContext.isSameSignature(ClassTypingContext.java:628)
	at spoon.support.visitor.ClassTypingContext.isSameSignature(ClassTypingContext.java:303)
	at spoon.support.reflect.declaration.CtTypeImpl$2.accept(CtTypeImpl.java:915)
	at spoon.support.reflect.declaration.CtTypeImpl$2.accept(CtTypeImpl.java:911)
	at spoon.reflect.visitor.chain.CtQueryImpl$OutputFunctionWrapper._accept(CtQueryImpl.java:459)
	at spoon.reflect.visitor.chain.CtQueryImpl$AbstractStep.accept(CtQueryImpl.java:307)
	at spoon.reflect.visitor.filter.AllTypeMembersFunction$1.accept(AllTypeMembersFunction.java:96)
	at spoon.reflect.visitor.filter.AllTypeMembersFunction$1.accept(AllTypeMembersFunction.java:79)
	at spoon.reflect.visitor.chain.CtQueryImpl$OutputFunctionWrapper._accept(CtQueryImpl.java:459)
	at spoon.reflect.visitor.chain.CtQueryImpl$AbstractStep.accept(CtQueryImpl.java:307)
	at spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction.sendResult(SuperInheritanceHierarchyFunction.java:360)
	at spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction.sendResultWithListener(SuperInheritanceHierarchyFunction.java:312)
	at spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction.visitSuperInterfaces(SuperInheritanceHierarchyFunction.java:299)
	at spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction.visitSuperClasses(SuperInheritanceHierarchyFunction.java:268)
	at spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction.lambda$visitSuperClasses$1(SuperInheritanceHierarchyFunction.java:280)
	at spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction.sendResultWithListener(SuperInheritanceHierarchyFunction.java:314)
	at spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction.visitSuperClasses(SuperInheritanceHierarchyFunction.java:279)
	at spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction.apply(SuperInheritanceHierarchyFunction.java:250)
	at spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction.apply(SuperInheritanceHierarchyFunction.java:36)
	at spoon.reflect.visitor.chain.CtQueryImpl$LazyFunctionWrapper._accept(CtQueryImpl.java:492)
	at spoon.reflect.visitor.chain.CtQueryImpl$AbstractStep.accept(CtQueryImpl.java:307)
	at spoon.reflect.visitor.chain.CtQueryImpl.forEach(CtQueryImpl.java:93)
  ...
  ...
	at spoon.support.visitor.ProcessingVisitor.scan(ProcessingVisitor.java:66)
	at spoon.support.QueueProcessingManager.process(QueueProcessingManager.java:118)
	at fr.inria.spirals.npefix.main.all.Launcher.instrument(Launcher.java:105)
	at fr.inria.spirals.npefix.main.run.Main.run(Main.java:70)
	at fr.inria.spirals.npefix.main.run.Main.main(Main.java:50)

Is this a known issue or am I running NPEFix incorrectly?

--
Best
Jose

How does NPEFix validate the candidate patches?

Sorry for disturbing you with this issue. I am interested in the NPEFix that is a good APR technique and also integrated into RepairThemAll. I now would like to ask for your help and guidance on the way of NPEFix to validate a candidate patch.

For example, does it firstly re-compile the candidate patch, and then run failing tests, and finally run all positive tests or all test cases?

It would be sincerely appreciated if any help could be provided.

Thank you in advance for your time and help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.