8004814: javadoc should be able to detect default methods
Reviewed-by: jjg
Contributed-by: maurizio.cimadamore@oracle.com
--- a/langtools/src/share/classes/com/sun/javadoc/ClassDoc.java Sun Dec 16 22:10:52 2012 -0800
+++ b/langtools/src/share/classes/com/sun/javadoc/ClassDoc.java Mon Dec 17 14:54:42 2012 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -66,6 +66,12 @@
boolean isExternalizable();
/**
+ * Return true if this class can be used as a target type of a lambda expression
+ * or method reference.
+ */
+ boolean isFunctionalInterface();
+
+ /**
* Return the serialization methods for this class or
* interface.
*
--- a/langtools/src/share/classes/com/sun/javadoc/MethodDoc.java Sun Dec 16 22:10:52 2012 -0800
+++ b/langtools/src/share/classes/com/sun/javadoc/MethodDoc.java Mon Dec 17 14:54:42 2012 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,11 @@
boolean isAbstract();
/**
+ * Return true if this method is default
+ */
+ boolean isDefault();
+
+ /**
* Get return type.
*
* @return the return type of this method, null if it
--- a/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Sun Dec 16 22:10:52 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Mon Dec 17 14:54:42 2012 +0000
@@ -276,6 +276,10 @@
return false;
}
+ public boolean isFunctionalInterface() {
+ return env.types.isFunctionalInterface(tsym);
+ }
+
/**
* Return the package that this class is contained in.
*/
--- a/langtools/src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java Sun Dec 16 22:10:52 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java Mon Dec 17 14:54:42 2012 +0000
@@ -76,6 +76,13 @@
}
/**
+ * Return true if this method is default
+ */
+ public boolean isDefault() {
+ return (sym.flags() & Flags.DEFAULT) != 0;
+ }
+
+ /**
* Return true if this method is abstract
*/
public boolean isAbstract() {