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 2023/01/01 07:55:43 UTC

[GitHub] [netbeans] jlahoda commented on a diff in pull request #5152: Extract source name from .class and use it to locate proper source

jlahoda commented on code in PR #5152:
URL: https://github.com/apache/netbeans/pull/5152#discussion_r1059718006


##########
java/java.editor/src/org/netbeans/modules/editor/java/GoToSupport.java:
##########
@@ -1193,47 +1204,60 @@ private void dumpArguments(List<? extends VariableElement> list, List<? extends
 
                 addSpace = true;
             }
-                
+
             result.append(')');
         }
 
         private void dumpThrows(List<? extends TypeMirror> list) {
             if (list.isEmpty()) {
                 return ;
             }
-            
+
             boolean addSpace = false;
-            
+
             result.append(" throws ");
-            
+
             for (TypeMirror t : list) {
                 if (addSpace) {
                     result.append(", ");
                 }
-                
+
                 result.append(getTypeName(info, t, true));
-                
+
                 addSpace = true;
             }
         }
-            
+
     }
-    
+
     private static String getTypeName(CompilationInfo info, TypeMirror t, boolean fqn) {
         return translate(Utilities.getTypeName(info, t, fqn).toString());
     }
-    
+
     private static String[] c = new String[] {"&", "<", ">", "\n", "\""}; // NOI18N
     private static String[] tags = new String[] {"&amp;", "&lt;", "&gt;", "<br>", "&quot;"}; // NOI18N
-    
+
     private static String translate(String input) {
         for (int cntr = 0; cntr < c.length; cntr++) {
             input = input.replace(c[cntr], tags[cntr]);
         }
-        
+
         return input;
     }
-    
+
+    static String findFileName(Element resolved) {

Review Comment:
   I suspect the best way would be to add an API method somewhere into java.source.base, returning a "source file name" for Elements that originate in a classfile - presumably, it could suggest it returns the value of the attribute. Or, vaguely speak about some "source file name", which could work for all Elements, whether form class or from source.
   
   `ElementUtilities` would normally be a fine place for a well-defined method, but I suspect this method may be a bit vague (and possibly single-purpose), so `SourceUtils` would sound better for a method like this.
   



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

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