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 243539 - default method in Interface does not work
Summary: default method in Interface does not work
Status: RESOLVED WORKSFORME
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL: Default methods are not supported in ...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-04 05:08 UTC by raoul
Modified: 2016-10-24 13:34 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 raoul 2014-04-04 05:08:28 UTC
Here is an interface I am working on:

public interface MultiLinearObject {
    
    public static final double MLO_DEFAULT_TOL = 1.0E-10;   // arbitrary choice

    boolean isAlmostSmallerThan(MultiLinearObject arg, double tol);


    default boolean isAlmostSmallerThan(MultiLinearObject arg){
        return isAlmostSmallerThan(arg, MLO_DEFAULT_TOL);
    }
}



The default method gets flagged as an error by NetBeans 8.0. The hint says: 

default methods are not supported in -source 1.7
(use -source 8 or higher to enable default methods)

But, I am using 1.8, and have in fact uninstalled all earlier versions of Java.

I googled on the error message and nothing came up.
Comment 1 Jiri Prox 2014-04-18 13:20:14 UTC
Please check your project properties. What source level do you use?
(Note that JDK 8 supports all previous source levels)
Comment 2 Svata Dedic 2014-08-21 09:10:59 UTC
Works for me when using JDK8; hint reacts also to project property change (source level degraded from JDK8 to JDK7). Should the defect happen again, check your project properties. If really using JDK8 and an adequate source level, please zip your project directory (nbproject subdirectory in your sources) and attach here, and reopen the bug; thanks.
Comment 3 keiranmraine 2015-04-21 09:13:40 UTC
If you are using Maven you need to update the version in pom.xml also, check:

<maven.compiler.source>X.X</maven.compiler.source>
<maven.compiler.target>X.X</maven.compiler.target>
Comment 4 sagarmahajan31997 2016-10-24 13:34:12 UTC
Just look at this