Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDE Basics #240

Open
wants to merge 132 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
54dda6d
Add IDE module
RobinKorke Jun 5, 2024
eb634e4
Basic model of IDE problems
RobinKorke Jun 5, 2024
fdf5928
First working solver
RobinKorke Jun 10, 2024
5bd3293
Integrate IDE solver into OPAL
RobinKorke Jun 10, 2024
30084ec
Improve debugging possibilities
RobinKorke Jun 10, 2024
5775d1a
Preparations to integrate IDE into TAC
RobinKorke Jun 10, 2024
aa4a0f0
Add abstraction layer to reduce complexity of analyses for Java programs
RobinKorke Jun 12, 2024
bfff8cb
Replace functions with properties
RobinKorke Jun 12, 2024
9970be9
Add IDE version of linear constant propagation
RobinKorke Jun 14, 2024
6c35b5e
Prepare test environment for linear constant propagation
RobinKorke Jun 14, 2024
146b123
Add tests for linear constant propagation
RobinKorke Jun 19, 2024
f0580ab
Fix IDE solver/linear constant propagation (temporary)
RobinKorke Jun 19, 2024
1c4062b
Fix linear constant propagation tests (some calls are identified as s…
RobinKorke Jun 24, 2024
95b3225
Add abstraction for IDE tests
RobinKorke Jun 24, 2024
2d80f58
Extend IDE problem function signatures to allow passing/using more in…
RobinKorke Jun 26, 2024
8a08d82
Refactor linear constant propagation edge functions
RobinKorke Jun 26, 2024
ae2fde6
Adjust/Fix linear constant propagation edge functions to find more co…
RobinKorke Jul 12, 2024
9e9326c
Implement end summaries extension
RobinKorke Jul 12, 2024
f61124e
Use end summaries in linear constant propagation
RobinKorke Jul 12, 2024
9bed114
Move safety check to ICFG implementation
RobinKorke Jul 15, 2024
7560325
Refactor flow recording
RobinKorke Jul 17, 2024
b518340
Add more logging
RobinKorke Jul 17, 2024
1cd6551
Introduce EdgeFunctionResult to allow usage of lazily computed proper…
RobinKorke Jul 19, 2024
542b49e
Small fixes
RobinKorke Jul 19, 2024
1e77801
Add equality check for properties
RobinKorke Jul 24, 2024
7615102
Reduce dependencies to IFDS
RobinKorke Jul 24, 2024
84c24c0
Fix dependee handling
RobinKorke Jul 24, 2024
978f0b7
Remove statement part from IDE properties
RobinKorke Jul 26, 2024
88717cc
Enable analyzing a certain statement inside a callable
RobinKorke Jul 26, 2024
3c1c6f1
Make cyclic analyses produce more precise results (and remove lambdas…
RobinKorke Jul 26, 2024
8be9534
Generate properties for all computed results
RobinKorke Jul 31, 2024
e479a5a
Some type fixes
RobinKorke Jul 31, 2024
8ba62dc
Fix some typos
RobinKorke Jul 31, 2024
9e28294
Add concept of additional seeds
RobinKorke Jul 31, 2024
2e87f98
Add problem-global identity edge function
RobinKorke Jul 31, 2024
26c05f2
Add predefined flow functions
RobinKorke Aug 2, 2024
00b598f
Prepare linear constant propagation for 'on fields' extension
RobinKorke Aug 2, 2024
324677a
Prepare linear constant propagation for 'on fields' extension
RobinKorke Aug 2, 2024
d3f8265
Extend linear constant propagation with array access expressions
RobinKorke Aug 2, 2024
c58da7e
Prepare linear constant propagation for 'on fields' extension
RobinKorke Aug 2, 2024
7215e99
Refactor test execution
RobinKorke Aug 7, 2024
83b08f9
Fix propagation and equality issues (esp. when applying end summaries)
RobinKorke Aug 7, 2024
31c83ad
Fix UnknownValueEdgeFunction going to edge function that produces Var…
RobinKorke Aug 7, 2024
9fa18e8
Pass callee to call-to-return edge function generation
RobinKorke Aug 7, 2024
c49b2d1
Add fallback for missing edge functions while recording flow (due to …
RobinKorke Aug 7, 2024
0386854
Hide ICFG construction in JavaIDEProblem
RobinKorke Aug 7, 2024
e678847
Add matcher for UnknownValue
RobinKorke Aug 7, 2024
e29b374
Add IDE version of LCP on fields
RobinKorke Aug 7, 2024
3473777
Prepare test environment for LCP on fields
RobinKorke Aug 7, 2024
3582288
Add tests for LCP on fields
RobinKorke Aug 7, 2024
7aa00ba
Add parameter to general PropertiesTest to allow non-final results at…
RobinKorke Aug 7, 2024
42d067b
Exchange InterimResults with empty dependees with PartialResults
RobinKorke Aug 12, 2024
ce3a418
Enhance directory handling and logging of FlowRecordingIDEAnalysis
RobinKorke Aug 12, 2024
387b72b
Merge branch 'refs/heads/develop' into ide-basics
RobinKorke Aug 12, 2024
ab90eef
Fix lines continued by operator
errt Aug 9, 2024
3865ca7
Add header to test files
errt Aug 9, 2024
ab125dc
Import formatting
errt Aug 9, 2024
2acf812
Apply formatter
RobinKorke Aug 12, 2024
610d108
Apply formatter
RobinKorke Sep 6, 2024
e2d6138
Fix result creation and introduce strict type and scheduler separatio…
RobinKorke Sep 6, 2024
6d6d8af
Add eager scheduler variant of IDEAnalysisProxy
RobinKorke Sep 6, 2024
c0910f9
Fix LCPOnFieldsTests to trigger property computation in phase
RobinKorke Sep 9, 2024
e7e718a
Revert "Add parameter to general PropertiesTest to allow non-final re…
RobinKorke Sep 9, 2024
ec9a1bc
Merge branch 'develop' into ide-basics
RobinKorke Sep 9, 2024
b4e7ae7
Apply formatter
RobinKorke Sep 9, 2024
5e6470b
Refactor callable passing in IDEAnalysis
RobinKorke Sep 9, 2024
f1ab938
Extend linear constant propagation to deal with boolean operators
RobinKorke Sep 13, 2024
d696969
Fix LCP on fields edge function computation
RobinKorke Sep 13, 2024
b224011
Refactor property matchers
RobinKorke Sep 13, 2024
45193f7
Fix IDEAnalysis final result creation
RobinKorke Sep 13, 2024
e05fcf2
Add facts and values to LCP on fields for array detection
RobinKorke Sep 13, 2024
3ba7a8b
Extend test annotations and matcher of LCP on fields
RobinKorke Sep 13, 2024
a710689
Refactor linear constant propagation problem definition
RobinKorke Sep 13, 2024
0809bad
Fix LCP on fields tests
RobinKorke Sep 13, 2024
dd5d496
Make IDEAnalysisProxy more robust
RobinKorke Sep 13, 2024
84d8e67
Extend LCP on fields problem with array detection
RobinKorke Sep 16, 2024
2ac5750
Extend LCP on fields problem with array detection
RobinKorke Sep 16, 2024
1fb83f8
Use method instead of string comparison
RobinKorke Sep 16, 2024
039a72a
Refactor logging
RobinKorke Sep 18, 2024
1f6577d
Refactor IDEAnalysisScheduler to adapt flow recording functionality
RobinKorke Sep 18, 2024
2e288d9
Prepare for backward analyses
RobinKorke Sep 18, 2024
388386e
Refactor ICFG and remove dependency to IFDS
RobinKorke Sep 25, 2024
5e886a5
Add backward problem and ICFG
RobinKorke Sep 25, 2024
bf67bcb
Refactor ICFG types
RobinKorke Sep 25, 2024
b5217e9
Add missing annotations and matchers for LCP on fields values
RobinKorke Oct 7, 2024
fa06f93
Add possibility to provide precomputed summary functions per problem …
RobinKorke Oct 7, 2024
a1acb01
Use precomputed summaries for linear constant propagation and LCP on …
RobinKorke Oct 7, 2024
9d3725b
Refactor LCP on fields facts
RobinKorke Oct 7, 2024
60f04a9
Prepare problem definitions for interim flow functions
RobinKorke Oct 7, 2024
8a2eb83
Implement interim flow functions
RobinKorke Oct 9, 2024
c5b4d39
Adjust dependee handling in phase 2
RobinKorke Oct 9, 2024
f7413d3
Document restrictions for interim flow functions
RobinKorke Oct 9, 2024
42b0731
Add IFDS integration based on IDE problems/solver
RobinKorke Oct 9, 2024
4f8f40c
Fix LCP on fields tests
RobinKorke Oct 11, 2024
7cff6f9
Fix ClassFile::staticInitializer loop termination
RobinKorke Oct 11, 2024
971703f
Extend LCP on fields analysis with immutability information to be abl…
RobinKorke Oct 11, 2024
fcfc831
Refactor ICFG being rooted at analysis scheduler and not at problem d…
RobinKorke Oct 28, 2024
dddf278
Refactor FlowFunction sourceFact parameter
RobinKorke Oct 28, 2024
de9d160
Refactor ICFG handling (and passing)
RobinKorke Oct 28, 2024
7819259
Fix callable result for analysis targets with multiple returns
RobinKorke Nov 15, 2024
db957e7
Add cache for TAC
RobinKorke Nov 15, 2024
12ef951
Resolve TODOs
RobinKorke Nov 15, 2024
47383b5
Optimize second phase of IDE solver
RobinKorke Nov 15, 2024
79bffb7
Update TODOs
RobinKorke Nov 15, 2024
6ad5aa4
Merge branch 'develop' into ide-basics
RobinKorke Nov 15, 2024
73470d2
Allow custom continuations when handling an edge function result
RobinKorke Dec 2, 2024
d887c2e
Allow custom edge functions for flows starting with additional seeds
RobinKorke Dec 2, 2024
bdc31b0
Improve LCP on fields for static fields
RobinKorke Dec 4, 2024
d5f9ad1
Add precomputed flow and summary function for static fields LCP
RobinKorke Dec 4, 2024
572f67a
Adjust analysis logging
RobinKorke Dec 9, 2024
8b606be
Fix corner cases of linear constant propagation and LCP on fields
RobinKorke Dec 9, 2024
cd390ef
Fix corner cases of linear constant propagation and LCP on fields
RobinKorke Jan 3, 2025
3f09a5b
Fix analysis of some more empty callables
RobinKorke Jan 3, 2025
4b64423
Fix return of special exceptions
RobinKorke Jan 3, 2025
3206fa8
Fix processing of static callables
RobinKorke Jan 3, 2025
bdfc72c
Fix logging issues
RobinKorke Jan 3, 2025
266743f
Optimize jump functions lookup
RobinKorke Jan 6, 2025
932d52f
Fix pattern matching exception in linear constant propagation
RobinKorke Jan 6, 2025
9ccdcb6
Fix termination issues due to faulty problem definition
RobinKorke Jan 8, 2025
84d1e63
Increase performance impact of raw results
RobinKorke Jan 8, 2025
57743a5
Extend IDE precomputation extension to be able to deal with call stat…
RobinKorke Jan 10, 2025
99f3902
Enhance precomputation for known callable in linear constant propagation
RobinKorke Jan 10, 2025
f1fc580
Implement precomputation for unknown callable in linear constant prop…
RobinKorke Jan 10, 2025
b16c37f
Fix hashCode implementation
RobinKorke Jan 13, 2025
b697e7e
Allow precomputed summary functions to be intermediate edge functions
RobinKorke Jan 17, 2025
0c7e9bf
More conservative handling of static fields in LCP on fields
RobinKorke Jan 17, 2025
e59dcfd
More precise summaries for object and array facts in LCP on fields
RobinKorke Jan 17, 2025
9497afa
More precise summaries for static facts in LCP on fields
RobinKorke Jan 17, 2025
afe0d81
Fix precomputed flow function generation for linear constant propagation
RobinKorke Jan 17, 2025
3a0fb6a
Fix linting issues
RobinKorke Jan 17, 2025
57a5bc1
Do not include runtime in IDE tests by default
RobinKorke Jan 17, 2025
31dacbb
Merge branch 'develop' into ide-basics
RobinKorke Jan 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* BSD 2-Clause License - see OPAL/LICENSE for details. */
package org.opalj.fpcf.fixtures.lcp_on_fields;

import org.opalj.fpcf.properties.lcp_on_fields.ArrayValue;
import org.opalj.fpcf.properties.lcp_on_fields.ArrayValues;
import org.opalj.fpcf.properties.lcp_on_fields.ConstantArrayElement;
import org.opalj.fpcf.properties.lcp_on_fields.VariableArrayElement;

public class ArrayNativeMethodExample {
@ArrayValues({
@ArrayValue(variable = "lv1", variableElements = {
@VariableArrayElement(index = 0),
@VariableArrayElement(index = 1),
@VariableArrayElement(index = 2),
@VariableArrayElement(index = 3)
}),
@ArrayValue(variable = "lvf", constantElements = {
@ConstantArrayElement(index = 0, value = 42),
@ConstantArrayElement(index = 1, value = 23)
}),
@ArrayValue(variable = "lv17", variableElements = {
@VariableArrayElement(index = 0),
@VariableArrayElement(index = 1),
@VariableArrayElement(index = 2),
@VariableArrayElement(index = 3),
@VariableArrayElement(index = 4),
@VariableArrayElement(index = 5)
})
})
public static void main(String[] args) {
int[] arr1 = new int[]{4, 5, 6, 7};
int[] arr2 = new int[]{42, 23};
int[] arr3 = new int[6];
System.arraycopy(arr1, 1, arr3, 2, 3);

System.out.println("arr1: {" + arr1[0] + ", " + arr1[1] + ", " + arr1[2] + ", " + arr1[3] + "}; arr2: {" +
arr2[0] + ", " + arr2[1] + "}; arr3: {" + arr3[0] + ", " + arr3[1] + ", " + arr3[2] + ", " + arr3[3] +
", " + arr3[4] + ", " + arr3[5] + "}");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* BSD 2-Clause License - see OPAL/LICENSE for details. */
package org.opalj.fpcf.fixtures.lcp_on_fields;

import org.opalj.fpcf.properties.lcp_on_fields.ArrayValue;
import org.opalj.fpcf.properties.lcp_on_fields.ArrayValues;
import org.opalj.fpcf.properties.lcp_on_fields.ConstantArrayElement;
import org.opalj.fpcf.properties.lcp_on_fields.VariableArrayElement;

public class ArrayReadWriteAcrossMethodsExample {
public void setIndexTo23(int[] arr, int index) {
arr[index] = 23;
}

public void set11To42(int[] arr) {
arr[11] = 42;
}

@ArrayValues({
@ArrayValue(variable = "lv3", variableElements = {
@VariableArrayElement(index = 0),
@VariableArrayElement(index = 1),
@VariableArrayElement(index = 2),
@VariableArrayElement(index = 3)
}),
@ArrayValue(variable = "lv5", constantElements = {
@ConstantArrayElement(index = 11, value = 42)
})
})
public static void main(String[] args) {
ArrayReadWriteAcrossMethodsExample example = new ArrayReadWriteAcrossMethodsExample();

int[] arr1 = new int[100];
int[] arr2 = new int[100];

example.setIndexTo23(arr1, 2);
example.set11To42(arr2);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* BSD 2-Clause License - see OPAL/LICENSE for details. */
package org.opalj.fpcf.fixtures.lcp_on_fields;

import org.opalj.fpcf.properties.lcp_on_fields.ArrayValue;
import org.opalj.fpcf.properties.lcp_on_fields.ArrayValues;
import org.opalj.fpcf.properties.lcp_on_fields.ConstantArrayElement;

public class ArrayReadWriteConstantExample {
@ArrayValues({
@ArrayValue(variable = "lv1", constantElements = {
@ConstantArrayElement(index = 0, value = 0),
@ConstantArrayElement(index = 1, value = 0),
@ConstantArrayElement(index = 2, value = 42),
@ConstantArrayElement(index = 3, value = 4),
@ConstantArrayElement(index = 4, value = 0)
}),
@ArrayValue(variable = "lv3", constantElements = {
@ConstantArrayElement(index = 0, value = 0),
@ConstantArrayElement(index = 1, value = 2),
@ConstantArrayElement(index = 2, value = 3),
@ConstantArrayElement(index = 3, value = 4)
})
})
public static void main(String[] args) {
int[] arr1 = new int[5];
int[] arr2 = new int[]{1, 2, 3, 4};

arr1[2] = 42;
arr1[3] = arr2[3];
arr2[0] = arr1[4];

System.out.println("arr1: {" + arr1[0] + ", " + arr1[1] + ", " + arr1[2] + ", " + arr1[3] + ", " + arr1[4] +
"}; arr2: {" + arr2[0] + ", " + arr2[1] + ", " + arr2[2] + ", " + arr2[3] + "}");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* BSD 2-Clause License - see OPAL/LICENSE for details. */
package org.opalj.fpcf.fixtures.lcp_on_fields;

import org.opalj.fpcf.properties.lcp_on_fields.ArrayValue;
import org.opalj.fpcf.properties.lcp_on_fields.ConstantArrayElement;
import org.opalj.fpcf.properties.lcp_on_fields.VariableArrayElement;
import org.opalj.fpcf.properties.linear_constant_propagation.ConstantValue;
import org.opalj.fpcf.properties.linear_constant_propagation.VariableValue;

public class ArrayUnknownIndicesExample {
@ArrayValue(variable = "lv1", variableElements = {
@VariableArrayElement(index = 0),
@VariableArrayElement(index = 1),
@VariableArrayElement(index = 10),
@VariableArrayElement(index = 11),
@VariableArrayElement(index = 12),
@VariableArrayElement(index = 13),
@VariableArrayElement(index = 98),
@VariableArrayElement(index = 99),
}, constantElements = {
@ConstantArrayElement(index = 50, value = 99)
})
@ConstantValue(variable = "lv9", value = 0)
@VariableValue(variable = "lvf")
public static void main(String[] args) {
int[] arr = new int[100];

int i;
int j;
if (args.length == 0) {
i = 42;
j = 11;
} else {
i = 23;
j = 12;
}

int a1 = arr[i];

arr[j] = 13;
arr[50] = 99;

int a2 = arr[i];

System.out.println("a1: " + a1 + ", a2: " + a2);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* BSD 2-Clause License - see OPAL/LICENSE for details. */
package org.opalj.fpcf.fixtures.lcp_on_fields;

import org.opalj.fpcf.properties.lcp_on_fields.ObjectValue;
import org.opalj.fpcf.properties.lcp_on_fields.ObjectValues;
import org.opalj.fpcf.properties.linear_constant_propagation.ConstantValue;
import org.opalj.fpcf.properties.linear_constant_propagation.UnknownValue;

public class CreateObjectInMethodExample {
private int a = 42;

private CreateObjectInMethodExample createNew1() {
CreateObjectInMethodExample example = new CreateObjectInMethodExample();
example.a -= 11;
return example;
}

private CreateObjectInMethodExample createNew2() {
CreateObjectInMethodExample example = new CreateObjectInMethodExample();
example.a = a + 2;
return example;
}

@ObjectValues({
@ObjectValue(variable = "lv0", constantValues = {@ConstantValue(variable = "a", value = 42)}),
@ObjectValue(variable = "lv2", constantValues = {@ConstantValue(variable = "a", value = 31)}),
@ObjectValue(variable = "lv3", unknownValues = {@UnknownValue(variable = "a")})
})
public static void main(String[] args) {
CreateObjectInMethodExample example1 = new CreateObjectInMethodExample();
CreateObjectInMethodExample example2 = example1.createNew1();
CreateObjectInMethodExample example3 = example2.createNew2();

System.out.println("e1: " + example1.a + ", e2: " + example2.a + ", e3: " + example3.a);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* BSD 2-Clause License - see OPAL/LICENSE for details. */
package org.opalj.fpcf.fixtures.lcp_on_fields;

import org.opalj.fpcf.properties.lcp_on_fields.ObjectValue;
import org.opalj.fpcf.properties.lcp_on_fields.ObjectValues;
import org.opalj.fpcf.properties.linear_constant_propagation.ConstantValue;
import org.opalj.fpcf.properties.linear_constant_propagation.VariableValue;

public class FieldReadWriteAcrossMethodsExample {
private int a = -2;

private void setA(int a) {
this.a = a;
}

private void setATo42() {
this.a = 42;
}

private int getA() {
return a;
}

@ObjectValues({
@ObjectValue(variable = "lv0", variableValues = {@VariableValue(variable = "a")}),
@ObjectValue(variable = "lv2", constantValues = {@ConstantValue(variable = "a", value = 42)}),
@ObjectValue(variable = "lv4", constantValues = {@ConstantValue(variable = "a", value = -2)})
})
public static void main(String[] args) {
FieldReadWriteAcrossMethodsExample example1 = new FieldReadWriteAcrossMethodsExample();
FieldReadWriteAcrossMethodsExample example2 = new FieldReadWriteAcrossMethodsExample();
FieldReadWriteAcrossMethodsExample example3 = new FieldReadWriteAcrossMethodsExample();

example1.setA(23);
int e1a = example1.getA();

example2.setATo42();
int e2a = example2.getA();

int e3a = example3.getA();

System.out.println("e1a: " + e1a + ", e2a: " + e2a + ", e3a: " + e3a);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* BSD 2-Clause License - see OPAL/LICENSE for details. */
package org.opalj.fpcf.fixtures.lcp_on_fields;

import org.opalj.fpcf.properties.lcp_on_fields.ObjectValue;
import org.opalj.fpcf.properties.lcp_on_fields.ObjectValues;
import org.opalj.fpcf.properties.linear_constant_propagation.ConstantValue;

public class FieldReadWriteConstantExample {
private int a = -1;

@ObjectValues({
@ObjectValue(variable = "lv0", constantValues = {@ConstantValue(variable = "a", value = -1)}),
@ObjectValue(variable = "lv2", constantValues = {@ConstantValue(variable = "a", value = 42)}),
@ObjectValue(variable = "lv4", constantValues = {@ConstantValue(variable = "a", value = 41)})
})
public static void main(String[] args) {
FieldReadWriteConstantExample example1 = new FieldReadWriteConstantExample();
FieldReadWriteConstantExample example2 = new FieldReadWriteConstantExample();
FieldReadWriteConstantExample example3 = new FieldReadWriteConstantExample();

example2.a = 23;
example2.a = 42;

example3.a = example2.a;
example3.a--;

System.out.println("e1: " + example1.a + ", e2: " + example2.a + ", e3: " + example3.a);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* BSD 2-Clause License - see OPAL/LICENSE for details. */
package org.opalj.fpcf.fixtures.lcp_on_fields;

import org.opalj.fpcf.properties.lcp_on_fields.ObjectValue;
import org.opalj.fpcf.properties.lcp_on_fields.ObjectValues;
import org.opalj.fpcf.properties.linear_constant_propagation.ConstantValue;
import org.opalj.fpcf.properties.linear_constant_propagation.VariableValue;

public class FieldReadWriteWithBranchingExample {
private int a = -1;

@ObjectValue(variable = "lv0", variableValues = {@VariableValue(variable = "a")})
public static FieldReadWriteWithBranchingExample multipleReturns(int y) {
FieldReadWriteWithBranchingExample e = new FieldReadWriteWithBranchingExample();
if (y > 0) {
e.a = 42;
return e;
} else {
e.a = 23;
return e;
}
}

@ObjectValues({
@ObjectValue(variable = "lv0", constantValues = {@ConstantValue(variable = "a", value = 42)}),
@ObjectValue(variable = "lv2", variableValues = {@VariableValue(variable = "a")}),
@ObjectValue(variable = "lv4", variableValues = {@VariableValue(variable = "a")})
})
public static void main(String[] args) {
FieldReadWriteWithBranchingExample example1 = new FieldReadWriteWithBranchingExample();
FieldReadWriteWithBranchingExample example2 = new FieldReadWriteWithBranchingExample();
FieldReadWriteWithBranchingExample example3 = new FieldReadWriteWithBranchingExample();

if (args.length == 0) {
example1.a = 42;
example2.a = 23;
example3.a = example2.a;
} else {
example1.a = 40;
example1.a += 2;
example3.a = example1.a;
}

System.out.println("e1: " + example1.a + ", e2: " + example2.a + ", e3: " + example3.a);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* BSD 2-Clause License - see OPAL/LICENSE for details. */
package org.opalj.fpcf.fixtures.lcp_on_fields;

import org.opalj.fpcf.properties.lcp_on_fields.ObjectValue;
import org.opalj.fpcf.properties.lcp_on_fields.ObjectValues;
import org.opalj.fpcf.properties.lcp_on_fields.VariableValue;
import org.opalj.fpcf.properties.linear_constant_propagation.ConstantValue;

public class ObjectNativeMethodExample {
int a = 2;

@VariableValue(variable = "lv0")
@ObjectValues({
@ObjectValue(variable = "lv2", constantValues = {
@ConstantValue(variable = "a", value = 2)
})
})
public static void main(String[] args) {
ObjectNativeMethodExample example1 = new ObjectNativeMethodExample();
ObjectNativeMethodExample example2 = new ObjectNativeMethodExample();

Class<?> clazz = example1.getClass();

System.out.println("example1.a: " + example1.a + ", example2.a: " + example2.a + ", clazz: " + clazz.getName());
}
}
Loading