Java function list: problems with "implements"



  • When parsing a Java file that contains an implements with a subclass (separated by a dot), the function list does not get populated anymore.

    Example that works perfect:

    public class Graph extends SuperGraph implements IGraph {
        private static final String TAG = Graph.class.getSimpleName();
    

    Same example fails when adding dot-separated implements:

    public class Graph extends SuperGraph implements IGraph.ISubGraph {
        private static final String TAG = Graph.class.getSimpleName();
    

    Function list also fails when implements are on a different line, like so:

    Works fine:

    public class Graph extends SuperGraph implements IGraph, ITelephone {
        private static final String TAG = Graph.class.getSimpleName();
    

    Fails:

    public class Graph extends SuperGraph implements IGraph
        , ITelephone {
        private static final String TAG = Graph.class.getSimpleName();


  • @Geert-Vancompernolle your example classes don’t contain function/method definitions so it’s no surprice to me the function list tree is not populated.



  • @MAPJe71

    Obviously, those classes do contain methods. I just wanted to show both situations where the function list works/doesn’t work with as minimal as possible code. Overloading the issue with redundant information is not the way to show the pain points of an issue.

    Adding/not adding methods to those examples is totally irrelevant here. But OK, if you want a complete code example (compiles, but really doesn’t do anything useful), here it is (and I don’t want to be blamed of making this thread too long…):

    Situation where functionlist works fine:

    Graph.java source file without the dot in the implements section:

    package graph;
    
    public class Graph implements IGraph, ITelephone {
    
        public static void main(String[] args) {
            Graph myGraph = new Graph();
            myGraph.doStart();
        }
    
        private void doStart() {
        }
    
        @Override
        public void doDraw(String string) {
            throw new UnsupportedOperationException("Not supported yet."); 
        }
    
        @Override
        public void doColour(int colour) {
            throw new UnsupportedOperationException("Not supported yet."); 
        }
    
        @Override
        public void doRing(int number) {
            throw new UnsupportedOperationException("Not supported yet."); 
        }
    
        @Override
        public void doAnswer(int number) {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    }
    

    Situation where functionlist doesn’t work:

    Graph.java with the dot in the implements section:

    The last two methods in the code example below are from an internal interface, hence the presence of the dot in one of the implements section:

    package graph;
    
    public class Graph implements IGraph, IGraph.IGraphInternal, ITelephone {
    
        public static void main(String[] args) {
            Graph myGraph = new Graph();
            myGraph.doStart();
        }
    
        private void doStart() {
        }
    
        @Override
        public void doDraw(String string) {
            throw new UnsupportedOperationException("Not supported yet."); 
        }
    
        @Override
        public void doColour(int colour) {
            throw new UnsupportedOperationException("Not supported yet."); 
        }
    
        @Override
        public void doRing(int number) {
            throw new UnsupportedOperationException("Not supported yet."); 
        }
    
        @Override
        public void doAnswer(int number) {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    
        @Override
        public void doDetailedDrawing() {
            throw new UnsupportedOperationException("Not supported yet."); 
        }
    
        @Override
        public void doDetailedColouring() {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    }
    

    And here’s the two interface files (in case you want to compile the stuff):

    IGraph iface with its internal IGraphInternal iface:

    package graph;
    
    public interface IGraph {
        void doDraw(String string);
        void doColour(int colour);
    
        interface IGraphInternals {
            void doDetailedDrawing();
            void doDetailedColouring();
        }
    }
    

    ITelephone iface:

    package graph;
    
    public interface ITelephone {
        void doRing(int number);
        void doAnswer(int number);
    }
    

    And to be complete: if I put some of the interfaces of the implements section on a new line (with or without the presence of the dot, doesn’t matter), the functionlist also doesn’t work. Like so:

    Graph.java source file without the dot in the implements section but with the implements section spread over different lines:

    package graph;
    
    public class Graph implements IGraph
        , ITelephone {
    
        public static void main(String[] args) {
            Graph myGraph = new Graph();
            myGraph.doStart();
        }
    
        private void doStart() {
        }
    
        @Override
        public void doDraw(String string) {
            throw new UnsupportedOperationException("Not supported yet."); 
        }
    
        @Override
        public void doColour(int colour) {
            throw new UnsupportedOperationException("Not supported yet."); 
        }
    
        @Override
        public void doRing(int number) {
            throw new UnsupportedOperationException("Not supported yet."); 
        }
    
        @Override
        public void doAnswer(int number) {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    }
    

    Hope the above is sufficient now.

    If you have time, feel free to copy/paste the Graph.java file into NPP and see for yourself (with and without the dot in the implements part / with and without the implements section on same or separate lines).

    Would like to hear your judgement.



  • Overloading the issue with redundant information is not the way to show the pain points of an issue.

    True but providing enough information for someone else to be able to analyse/confirm the issue is.
    e.g.

    public class GraphIssue1 implements IGraph, IGraph.IGraphInternal, ITelephone {
        public static void main(String[] args) {
            // method body        
        }
    }
    public class GraphIssue2 implements IGraph, IGraph
        , ITelephone {
        public static void main(String[] args) {
            // method body        
        }
    }
    

    Nevertheless, I can’t reproduce the issue with the Java parser provided with Notepad++ as of version 7.5.2.0.
    Notes:

    1. make sure there is a newline after the closing curly brace of a class/interface definition.
    2. the interface definitions will not show up in the tree as they do not contain method definitions. AFAIK interfaces never do so that’s an issue i will have to look into.


  • @MAPJe71 - That is really weird. I’m even using NPP 7.5.4 and still have the issue with this version. I’ve compiled a video to show you the issue. Pls. check here: vimeo.com/256277404.



  • Your system might contain more than one functionList.xml and Notepad++ is using a different one than you’d expect or one of the plugins is interfering, try running N++ without plugins.



  • @MAPJe71 said:

    Your system might contain more than one functionList.xml and Notepad++ is using a different one than you’d expect or one of the plugins is interfering, try running N++ without plugins.

    Well, you are absolutely right! There was another functionlist.xml file located in my roaming directory. I’ve kicked out that one and now all is working fine.

    Great catch, didn’t see it myself!