This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 252760 - It's not possible to evaluate a private method in an interface
Summary: It's not possible to evaluate a private method in an interface
Status: RESOLVED WONTFIX
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 8.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords: JDK_9
Depends on:
Blocks:
 
Reported: 2015-06-02 17:18 UTC by Martin Entlicher
Modified: 2015-06-03 10:01 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Entlicher 2015-06-02 17:18:06 UTC
Consider an interface with a private method, like:

public interface TestInterface {
    
    public default double fact(int n) {
        double f = 1;
        for (int i = 1; i <= n; i++) {
            f *= i;
        }
        return f;
    }
    
    private double zfact(int n) {
        double f = 1;
        for (int i = 1; i <= n; i++) {
            f *= i;
        }
        return -f;
    }
    
    public default double callZFact(int n) {
        return zfact(n);
    }
    
    double afact(int n);
}

and it's implementation:

public class TestImpl implements TestInterface {

    @Override
    public double afact(int n) {
        if (n >= 1) {
            double f = callZFact(n);
            return f;
        }
        return Double.NaN;
    }
}

Then call it like:
 TestImpl ti = new TestImpl();
 ti.afact(10);

Suspend the program on "ti.afact(10);" line and evaluate "ti.zfact(2)" expression.
An java.lang.AbstractMethodError is thrown.
Comment 1 Martin Entlicher 2015-06-03 10:01:49 UTC
Submitted:
https://bugs.openjdk.java.net/browse/JDK-8081800

I do not think we can workaround this issue.