You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/08/13 09:20:07 UTC

[GitHub] [netbeans] singh-akhilesh commented on a change in pull request #2307: [NETBEANS-4062] Fixed issue : import RECORD from other package hint

singh-akhilesh commented on a change in pull request #2307:
URL: https://github.com/apache/netbeans/pull/2307#discussion_r469815848



##########
File path: java/java.source.base/src/org/netbeans/api/java/source/ElementHandle.java
##########
@@ -436,7 +436,7 @@ public boolean signatureEquals (@NonNull final T element) {
      * @param kind the {@link ElementKind} of the {@link TypeElement},
      * allowed values are {@link ElementKind#CLASS}, {@link ElementKind#INTERFACE},
      * {@link ElementKind#ENUM} and {@link ElementKind#ANNOTATION_TYPE}.
-     * @param binaryName the class binary name as specified by JLS §13.1
+     * @param binaryName the class binary name as specified by JLS ยง13.1

Review comment:
       comment addressed

##########
File path: java/java.source.base/src/org/netbeans/api/java/source/ElementHandle.java
##########
@@ -634,7 +634,11 @@ public ElementHandle create(ElementKind kind, String... descriptors) {
                     }
                     return new ElementHandle<VariableElement> (kind, descriptors);
                 default:
-                    throw new IllegalArgumentException ();
+                    if(kind.name().equals(TreeShims.RECORD) &&  (descriptors.length == 1)) {
+                        return new ElementHandle<TypeElement> (kind, descriptors);
+                    }
+                    else throw new IllegalArgumentException ();

Review comment:
       comment addressed

##########
File path: java/java.source.base/src/org/netbeans/api/java/source/GeneratorUtilities.java
##########
@@ -1142,7 +1143,12 @@ public CompilationUnitTree addImports(CompilationUnitTree cut, Set<? extends Ele
                     el = e.getEnclosingElement();
                     break;
                 default:
-                    assert false : "Illegal element kind: " + e.getKind(); //NOI18N
+                    if (TreeShims.isRecord(e)) {
+                        if (e.getEnclosingElement().getKind() == ElementKind.PACKAGE) {
+                            el = e.getEnclosingElement();
+                        }
+                    } else
+                        assert false : "Illegal element kind: " + e.getKind(); //NOI18N

Review comment:
       comment addressed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists