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

Second Phase of RLC inference #6278

Merged
merged 182 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 172 commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
695416d
first phase
Nargeshdb May 15, 2023
ab26997
update comments
Nargeshdb May 15, 2023
ad74e0b
Undo wildcard imports
mernst May 15, 2023
1f16be4
Merge ../checker-framework-branch-master into inference-phase-one
mernst May 16, 2023
833231f
Put shorter clauses first
mernst May 16, 2023
22af6f6
address comments
Nargeshdb May 22, 2023
2d23295
address feedbacks
Nargeshdb May 24, 2023
155ded6
address feedbacks
Nargeshdb May 24, 2023
ef2ac88
update shouldPerformWholeProgramInference in MustCallTransfer
Nargeshdb May 24, 2023
6a28bfc
Merge branch 'master' into inference-phase-one
Nargeshdb May 24, 2023
617a7c7
add comments
Nargeshdb May 25, 2023
8f27be1
Merge remote-tracking branch 'origin' into inference-phase-one
Nargeshdb May 25, 2023
e455aa1
Merge branch 'master' into inference-phase-one
Nargeshdb Jun 13, 2023
3a483f5
update
Nargeshdb Jun 16, 2023
2e87329
update comments
Nargeshdb Jun 22, 2023
aae7e30
address Martin's feedback
Nargeshdb Jun 26, 2023
c48227b
address comments
Nargeshdb Jun 29, 2023
d83eb35
address Martin's comments
Nargeshdb Jun 29, 2023
98279da
update java doc for checkMethodInvocation
Nargeshdb Aug 4, 2023
37cd3e2
update
Nargeshdb Aug 4, 2023
9e2cc1a
update java doc for checkMethodInvocation
Nargeshdb Aug 4, 2023
a958009
add a test case
Nargeshdb Apr 28, 2023
f795b0e
update
Nargeshdb Aug 4, 2023
7e678fb
update
Nargeshdb Aug 4, 2023
d32645e
fix deprecation warning
Nargeshdb Aug 8, 2023
ee90781
remove a MustAliasWithDifferentMCSet.java
Nargeshdb Aug 8, 2023
3bd8772
update
Nargeshdb Aug 8, 2023
74cfa33
cleanup
Nargeshdb Aug 11, 2023
6b9f194
handle arguments passed in varArgs position
Nargeshdb Aug 18, 2023
6b787ca
address Martin's feedback
Nargeshdb Aug 18, 2023
7d85c7f
address Martin's feedback
Nargeshdb Aug 18, 2023
3b7d062
update EnsuresCalledMethodsTest
Nargeshdb Aug 19, 2023
421cdbc
remove changes in MCCA
Nargeshdb Aug 22, 2023
bd1372e
pass -AenableWPIForRLC flag to wpi-many test and update manual
Nargeshdb Aug 23, 2023
4993d96
update
Nargeshdb Aug 23, 2023
1849e13
update
Nargeshdb Aug 23, 2023
7dd793a
address Martin's feedback
Nargeshdb Aug 25, 2023
6e518fb
Merge ../checker-framework-branch-master into inference-phase-one
mernst Aug 28, 2023
e5da11a
Documentation tweaks
mernst Aug 28, 2023
6b00ac4
Tweaks
mernst Aug 28, 2023
111c0aa
Documentation improvements
mernst Aug 28, 2023
15097e2
Code review changes
mernst Aug 29, 2023
c968553
Merge ../checker-framework-branch-master into inference-phase-one
mernst Aug 30, 2023
f53afbc
Code review changes
mernst Aug 30, 2023
5216a62
Comment improvements
mernst Aug 30, 2023
885d952
Renaming
mernst Aug 30, 2023
4e9a811
Renaming and comment improvements
mernst Aug 30, 2023
8af4608
Comments
mernst Aug 30, 2023
da6f840
Documentation edits
mernst Aug 30, 2023
6f0ad6e
Code improvements
mernst Aug 30, 2023
16e9687
address Mike's comments (part 1)
Nargeshdb Sep 6, 2023
51cfa50
address Mike's comments
Nargeshdb Sep 7, 2023
3be91db
improve documentation
Nargeshdb Sep 8, 2023
e32a557
Merge ../checker-framework-branch-master into inference-phase-one
mernst Sep 8, 2023
6005941
address Mike's comments
Nargeshdb Sep 14, 2023
ae36399
merge
Nargeshdb Sep 14, 2023
dc24008
Merge ../checker-framework-branch-master into inference-phase-one
mernst Sep 14, 2023
29e941e
Merge ../checker-framework-branch-master into inference-phase-one
mernst Sep 14, 2023
996cce1
Renamings
mernst Sep 14, 2023
e0cb22b
Remove unneeded "Logic"
mernst Sep 15, 2023
998c87a
Merge branch 'inference-phase-one' of github.com:nargeshdb/checker-fr…
mernst Sep 15, 2023
447e1ed
Tweaks
mernst Sep 15, 2023
f4eb105
Tweaks
mernst Sep 15, 2023
a1eb2c1
Renaming, comments
mernst Sep 15, 2023
39c9961
Add import statement
mernst Sep 15, 2023
d4157d0
Merge /scratch/mernst/clones/types/checker-framework-branch-master in…
mernst Sep 16, 2023
4911657
improve documentation and names
Nargeshdb Sep 19, 2023
1ab7ff1
improve comments
Nargeshdb Sep 20, 2023
612ef9d
Merge remote-tracking branch 'origin' into inference-phase-one
Nargeshdb Sep 20, 2023
1299f7a
add more detail about -AenableWpiForRlc
Nargeshdb Sep 20, 2023
372cac3
Merge branch 'master' into inference-phase-one
msridhar Sep 21, 2023
48f5a01
remove static import
msridhar Sep 21, 2023
09fb026
Merge branch 'master' into inference-phase-one
msridhar Sep 23, 2023
2c70b8d
Merge ../checker-framework-branch-master into inference-phase-one
mernst Sep 24, 2023
a6e8546
change AenableWPIForRLC to AenableWpiForRlc
Nargeshdb Sep 25, 2023
12ee23a
revert changes in addOwningToParamsIfDisposedAtAssignment
Nargeshdb Sep 25, 2023
3761941
Compatibility with Java 8; add toString methods
mernst Sep 25, 2023
d7ed3dd
Add diagnostic output
mernst Sep 25, 2023
c6a94f1
Merge branch 'inference-phase-one' of github.com:nargeshdb/checker-fr…
mernst Sep 25, 2023
17b7853
add changes back
Nargeshdb Sep 25, 2023
bc0b737
Merge branch 'master' into inference-phase-one
Nargeshdb Sep 25, 2023
8354a14
improve perf
Nargeshdb Sep 25, 2023
36ddd8e
Merge branch 'master' into inference-phase-one
Nargeshdb Sep 26, 2023
c1c3d7b
make all indexes 1-based
Nargeshdb Sep 26, 2023
f70a11e
fix
Nargeshdb Sep 26, 2023
94bb05f
Merge branch 'inference-phase-one' of github.com:nargeshdb/checker-fr…
mernst Sep 28, 2023
a64af88
Merge ../checker-framework-branch-master into inference-phase-one
mernst Sep 28, 2023
9ffc0a1
Merge branch 'master' into inference-phase-one
msridhar Oct 2, 2023
7110866
fix compile error
msridhar Oct 2, 2023
206643d
Code review changes
mernst Oct 2, 2023
f6e82cc
Merge branch 'inference-phase-one' of github.com:nargeshdb/checker-fr…
mernst Oct 2, 2023
4cda0ed
Brevity
mernst Oct 2, 2023
0bc4ed8
Lazily create HashSet
mernst Oct 2, 2023
5a57c79
Comment tweaks and a renaming
mernst Oct 2, 2023
145bb3e
Reduce duplication in explanation of `-AenableWpiForRlc`
mernst Oct 2, 2023
4caab8a
Comments
mernst Oct 2, 2023
8b6896f
Improve comments
mernst Oct 2, 2023
79e2911
address all feedbacks
Nargeshdb Oct 3, 2023
041fc0a
merge
Nargeshdb Oct 3, 2023
2f6d925
Merge ../checker-framework-branch-master into inference-phase-one
mernst Oct 4, 2023
bbcc548
Merge branch 'inference-phase-one' of github.com:nargeshdb/checker-fr…
mernst Oct 4, 2023
d21d164
update names and docs
Nargeshdb Oct 5, 2023
fa72f43
fix
Nargeshdb Oct 5, 2023
1793e3f
Merge branch 'master' into inference-phase-one
Nargeshdb Oct 5, 2023
ca50189
Update checker/src/main/java/org/checkerframework/checker/resourcelea…
Nargeshdb Oct 7, 2023
61283f1
Update checker/src/main/java/org/checkerframework/checker/resourcelea…
Nargeshdb Oct 7, 2023
cdcb572
Update checker/src/main/java/org/checkerframework/checker/resourcelea…
Nargeshdb Oct 7, 2023
a18c47f
Update checker/src/main/java/org/checkerframework/checker/resourcelea…
Nargeshdb Oct 7, 2023
5a4c853
Update checker/src/main/java/org/checkerframework/checker/resourcelea…
Nargeshdb Oct 7, 2023
39bc3aa
Update checker/src/main/java/org/checkerframework/checker/resourcelea…
Nargeshdb Oct 7, 2023
0155950
update names of methods
Nargeshdb Oct 7, 2023
3f116a1
update comments
msridhar Oct 8, 2023
271d455
address some comments
Nargeshdb Oct 8, 2023
beac03b
Merge branch 'inference-phase-one-2' into inference-phase-one
Nargeshdb Oct 8, 2023
a4ffad6
update
Nargeshdb Oct 9, 2023
a8128d2
address Manu's feedback
Nargeshdb Oct 10, 2023
233d349
Update checker/src/main/java/org/checkerframework/checker/resourcelea…
Nargeshdb Oct 10, 2023
79a6d92
Update checker/src/main/java/org/checkerframework/checker/resourcelea…
Nargeshdb Oct 10, 2023
b473dbc
reformat
Nargeshdb Oct 10, 2023
6c254aa
remove disposedField.clear
Nargeshdb Oct 10, 2023
6be4874
Update checker/src/main/java/org/checkerframework/checker/resourcelea…
Nargeshdb Oct 11, 2023
06900ac
Update checker/src/main/java/org/checkerframework/checker/resourcelea…
Nargeshdb Oct 11, 2023
518a598
Update checker/src/main/java/org/checkerframework/checker/resourcelea…
Nargeshdb Oct 11, 2023
74bf6d2
Update checker/src/main/java/org/checkerframework/checker/resourcelea…
Nargeshdb Oct 11, 2023
ffc2472
imptove comments
Nargeshdb Oct 11, 2023
217e105
update method name
Nargeshdb Oct 11, 2023
3ee6e82
check ownership transfer on object creation node
Nargeshdb Oct 12, 2023
3c7d78a
Merge branch 'master' into inference-phase-one
mernst Oct 12, 2023
13e16da
update
Nargeshdb Oct 12, 2023
8ab8a64
update
Nargeshdb Oct 12, 2023
3acf330
cleanup
Nargeshdb Oct 13, 2023
80323c3
Merge branch 'master' into inference-phase-one
msridhar Oct 13, 2023
f3d465c
Merge branch 'master' into inference-phase-one
msridhar Oct 13, 2023
75f2e84
minor tweaks
msridhar Oct 13, 2023
f089e3c
add annotations after the while loop
Nargeshdb Oct 13, 2023
3a7cfda
Merge branch 'master' into inference-phase-one
msridhar Oct 15, 2023
2b2cca2
improve documentation
Nargeshdb Oct 17, 2023
eb9f86f
update
Nargeshdb Oct 17, 2023
c03056b
improve comments
Nargeshdb Oct 17, 2023
2e3c073
second-phase of inference
Nargeshdb Oct 19, 2023
8bfa69c
merge
Nargeshdb Oct 19, 2023
dd2e68d
reformat
Nargeshdb Oct 19, 2023
8f3debe
refactor
Nargeshdb Oct 20, 2023
8068f05
refactor
Nargeshdb Oct 20, 2023
d2d896b
Merge branch 'inference-phase-one' into inference-phase-two
Nargeshdb Oct 20, 2023
b33b705
add a test
Nargeshdb Oct 23, 2023
d4128a6
remove unneeded changes
Nargeshdb Oct 23, 2023
3b39cbb
update comments
Nargeshdb Oct 24, 2023
f80dcde
Merge branch 'master' into inference-phase-one
Nargeshdb Oct 24, 2023
bf851fc
remove the test
Nargeshdb Oct 24, 2023
a0670c1
Merge branch 'inference-phase-one' into inference-phase-two
Nargeshdb Oct 24, 2023
53e6f05
update comments
Nargeshdb Oct 24, 2023
3011552
add arg
Nargeshdb Oct 24, 2023
67f7b52
1-based map
Nargeshdb Oct 24, 2023
1e5499f
add a test
Nargeshdb Oct 24, 2023
29cfb1f
make debug method static
kelloggm Oct 25, 2023
4b64bf4
Merge branch 'master' into inference-phase-one
Nargeshdb Oct 25, 2023
2ed4210
address feedbacks
Nargeshdb Oct 26, 2023
124f3d0
typo
Nargeshdb Oct 30, 2023
09d1d4e
infer @MCA for receiver
Nargeshdb Oct 31, 2023
7fa1eea
Merge branch 'inference-phase-one' into inference-phase-two
Nargeshdb Oct 31, 2023
1274c9b
merge
Nargeshdb Oct 31, 2023
4f46157
address feedback
Nargeshdb Oct 31, 2023
fe2554c
add a comment
Nargeshdb Nov 1, 2023
e679bfe
update doc
Nargeshdb Nov 2, 2023
4cba487
Merge branch 'master' into inference-phase-two
Nargeshdb Nov 2, 2023
69d8a42
update tests
Nargeshdb Nov 7, 2023
f650990
Merge branch 'master' into inference-phase-two
msridhar Nov 8, 2023
9b46a6d
Merge ../checker-framework-branch-master into inference-phase-two
mernst Nov 13, 2023
6f38468
add comments for test
Nargeshdb Nov 13, 2023
5c86c43
Merge branch 'inference-phase-two' of github.com:nargeshdb/checker-fr…
mernst Nov 14, 2023
8b41fec
Code review changes
mernst Nov 14, 2023
db0ed91
Comments
mernst Nov 14, 2023
7a735cd
Add TODO comments
mernst Nov 14, 2023
d107269
improve comments
Nargeshdb Nov 15, 2023
ea65dc4
address Mike's comments
Nargeshdb Nov 16, 2023
6f4819d
chage disposedFields set to map
Nargeshdb Nov 17, 2023
d8681c0
Merge branch 'master' into inference-phase-two
Nargeshdb Nov 17, 2023
b4e1b2a
Merge ../checker-framework-branch-master into inference-phase-two
mernst Nov 24, 2023
2ba55f1
Merge ../checker-framework-branch-master into inference-phase-two
mernst Dec 4, 2023
324e9f6
Merge branch 'master' into inference-phase-two
msridhar Dec 4, 2023
acc5d3e
remove unneeded resource variable logic
msridhar Dec 4, 2023
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
Expand Up @@ -1815,7 +1815,7 @@ private List<Node> getMustCallAliasArgumentNodes(Node callNode) {
* @param node a node
* @return either a tempvar for node's content sans typecasts, or node
*/
private Node removeCastsAndGetTmpVarIfPresent(Node node) {
/*package-private*/ Node removeCastsAndGetTmpVarIfPresent(Node node) {
// TODO: Create temp vars for TypeCastNodes as well, so there is no need to explicitly
// remove casts here.
node = NodeUtils.removeCasts(node);
Expand Down

Large diffs are not rendered by default.

92 changes: 92 additions & 0 deletions checker/tests/ainfer-resourceleak/non-annotated/AddNotOwning.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// This test ensures that the @NotOwning annotation is inferred for the return type of a method if
// it returns a field.

import org.checkerframework.checker.calledmethods.qual.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all these tests in the non-annotated folder it's unclear to me what is being tested. Can you explain how these tests work, or is it documented somewhere?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's documented here: https://github.com/typetools/checker-framework/blob/master/checker/tests/ainfer-README

That document describes the "TestChecker", but for these tests the same process is used with the RLC instead. This README is also symlinked from the ainfer-resourceleak/ directory.

import org.checkerframework.checker.mustcall.qual.*;

class AddNotOwning {

@InheritableMustCall("a")
static class Foo {
void a() {}
}

static class NonEmptyMustCallFinalField {
final Foo f; // expect owning annotation for this field

NonEmptyMustCallFinalField() {
// :: warning: (required.method.not.called)
f = new Foo();
}

Foo getField() {
return f;
}

Foo getFieldOnSomePath() {
if (true) {
return null;
} else {
return f;
}
}

void testNotOwningOnFinal() {
// :: warning: (required.method.not.called)
Foo f = getField();
}

void testNotOwningOnGetFieldOnSomePath() {
// :: warning: (required.method.not.called)
Foo f = getFieldOnSomePath();
}

@EnsuresCalledMethods(
value = {"this.f"},
methods = {"a"})
void dispose() {
f.a();
}
}

@InheritableMustCall("dispose")
static class NonEmptyMustCallNonFinalField {
Foo f; // expect owning annotation for this field

@SuppressWarnings("missing.creates.mustcall.for")
void initialyzeFoo() {
f.a();
// :: warning: (required.method.not.called)
f = new Foo();
}

Foo getField() {
return f;
}

Foo getFieldOnSomePath() {
if (true) {
return null;
} else {
return f;
}
}

void testNotOwningOnNonFinal() {
// :: warning: (required.method.not.called)
Foo f = getField();
}

void testNotOwningOnGetFieldOnSomePath() {
// :: warning: (required.method.not.called)
Foo f = getFieldOnSomePath();
}

@EnsuresCalledMethods(
value = {"this.f"},
methods = {"a"})
void dispose() {
f.a();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// This test ensures that the @MustCallAlias annotation is not inferred when the enclosing class has
// more than one owning field.

import org.checkerframework.checker.calledmethods.qual.*;
import org.checkerframework.checker.mustcall.qual.*;

class ClassWithTwoOwningFieldsTest {
@InheritableMustCall("a")
static class Foo {
void a() {}
}

@InheritableMustCall("close")
private class ClassWithTwoOwningFields {
// :: warning: (required.method.not.called)
final @Owning Foo foo1;
// :: warning: (required.method.not.called)
final @Owning Foo foo2;

public ClassWithTwoOwningFields(Foo f1, Foo f2) {
foo1 = f1;
foo2 = f2;
}

void close() {
foo1.a();
foo2.a();
}
}

void testTwoOwning() {
// :: warning: (required.method.not.called)
Foo f1 = new Foo();
// :: warning: (required.method.not.called)
Foo f2 = new Foo();

ClassWithTwoOwningFields ff = new ClassWithTwoOwningFields(f1, f2);
ff.close();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// @skip-test until we have support for adding annotation on the receiver parameter.

import java.io.*;
import org.checkerframework.checker.calledmethods.qual.*;
import org.checkerframework.checker.mustcall.qual.*;

@InheritableMustCall("close")
public class MustCallAliasOnReceiver {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this test called MustCallAliasOnReceiver? It looks like it is testing adding of @MustCallAlias on a static method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now we don't have support adding @MustCallAlias annotation to the receiver parameter, so I removed the related test from this file to avoid crashes, I added it back, and instead I added // @skip-test in this file.


final @Owning InputStream is;

@MustCallAlias MustCallAliasOnReceiver(@MustCallAlias InputStream p, boolean b) {
this.is = p;
}

MustCallAliasOnReceiver returnReceiver(MustCallAliasOnReceiver this) {
return this;
}

// :: warning: (required.method.not.called)
void testReceiverMCAAnnotation(@Owning InputStream inputStream) throws IOException {
MustCallAliasOnReceiver mcar = new MustCallAliasOnReceiver(is, false);
mcar.returnReceiver().close();
}

@EnsuresCalledMethods(value = "this.is", methods = "close")
public void close() throws IOException {
this.is.close();
}

public static MustCallAliasOnReceiver mcaneFactory(InputStream is) {
return new MustCallAliasOnReceiver(is, false);
}

// :: warning: (required.method.not.called)
public static void testUse(@Owning InputStream inputStream) throws Exception {
MustCallAliasOnReceiver mcane = mcaneFactory(inputStream);
mcane.close();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// This test ensures that the all-paths condition for inferring the @MustCallAlias annotation is
// restricted to the examination of 'Regular' paths.

import java.io.IOException;
import org.checkerframework.checker.calledmethods.qual.*;
import org.checkerframework.checker.mustcall.qual.*;

class MustCallAliasOnRegularExits {

@InheritableMustCall("a")
static class Foo {
void a() {}

int b() throws IOException {
return 0;
}
}

private class MCAConstructor extends Foo {

protected final @Owning Foo f;
protected long s = 0L;

// The Must Call Checker for assigning @MustCallAlias parameters to @Owning fields reports a
// false positive.
@SuppressWarnings("assignment")
protected MCAConstructor(Foo foo) throws IOException {
if (foo == null) {
this.s = foo.b();
}
this.f = foo;
}

@EnsuresCalledMethods(
value = {"this.f"},
methods = {"a"})
public void a() {
f.a();
}
}

void testMCAOnMCAConstructor() {
Foo f = new Foo();
try {
// :: warning: (required.method.not.called)
MCAConstructor mcaf = new MCAConstructor(f);
} catch (IOException e) {
} finally {
f.a();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
// This test examines all scenarios for inferring the @MustCallAlias annotation.

import org.checkerframework.checker.calledmethods.qual.*;
import org.checkerframework.checker.mustcall.qual.*;

class MustCallAliasParams {

@InheritableMustCall("a")
static class Foo {
void a() {}
}

@InheritableMustCall("a")
private class MCAConstructor {

final @Owning Foo f;

// The Must Call Checker for assigning @MustCallAlias parameters to @Owning fields reports a
// false positive.
@SuppressWarnings("assignment")
MCAConstructor(Foo foo) {
f = foo;
}

@EnsuresCalledMethods(
value = {"this.f"},
methods = {"a"})
public void a() {
f.a();
}
}

void testMCAConstructor() {
// :: warning: (required.method.not.called)
Foo f = new Foo();
MCAConstructor mcac = new MCAConstructor(f);
mcac.a();
}

@InheritableMustCall("a")
private class MCASuperClass {
int i;
final @Owning Foo f;

// The Must Call Checker for assigning @MustCallAlias parameters to @Owning fields reports a
// false positive.
@SuppressWarnings("assignment")
@MustCallAlias MCASuperClass(@MustCallAlias Foo foo, int i) {
f = foo;
i = i;
}

@EnsuresCalledMethods(
value = {"this.f"},
methods = {"a"})
public void a() {
f.a();
}
}

private class MCASuperCall extends MCASuperClass {
MCASuperCall(Foo foo) {
super(foo, 1);
}
}

void mCASuperCallTest() {
// :: warning: (required.method.not.called)
Foo f = new Foo();
MCASuperCall mcaSuperCall = new MCASuperCall(f);
mcaSuperCall.a();
}

private class MCAThisCall extends MCASuperClass {
@MustCallAlias MCAThisCall(@MustCallAlias Foo foo) {
super(foo, 1);
}

MCAThisCall(Foo foo, boolean b) {
this(foo);
}
}

void mCAThisCallTest() {
// :: warning: (required.method.not.called)
Foo f = new Foo();
MCAThisCall mcaThisCall = new MCAThisCall(f, true);
mcaThisCall.a();
}

private class MCAMethod {
Foo returnFoo(Foo foo) {
return foo;
}

void returnFooTest() {
// :: warning: (required.method.not.called)
Foo f = new Foo();
Foo foo = returnFoo(f);
foo.a();
}

Foo returnAliasFoo(Foo foo) {
Foo f = foo;
return f;
}

MCASuperClass returnAliasFoo2(Foo foo, int i) {
MCASuperClass f = new MCASuperClass(foo, i);
return f;
}

void testReturnAliasFoo2() {
// :: warning: (required.method.not.called)
Foo foo = new Foo();
MCASuperClass f = returnAliasFoo2(foo, 0);
f.a();
}

void returnAliasFooTest() {
// :: warning: (required.method.not.called)
Foo f = new Foo();
Foo foo = returnAliasFoo(f);
foo.a();
}

Foo returnFooAllPaths(Foo foo) {
if (true) {
Foo f = foo;
return f;
} else {
return foo;
}
}

void returnFooAllPathsTest() {
// :: warning: (required.method.not.called)
Foo f = new Foo();
Foo foo = returnFooAllPaths(f);
foo.a();
}

Foo returnFooSomePath(Foo foo) {
if (true) {
Foo f = new Foo();
return f;
} else {
return foo;
}
}

void returnFooSomePathTest() {
Foo f = new Foo();
Foo foo = returnFooSomePath(f);
f.a();
foo.a();
}
}
}
Loading