c2nes / javalang

Pure Python Java parser and tools
MIT License
737 stars 161 forks source link

InstanceOf Binary Operator doesn't have code line #75

Closed lyriccoder closed 4 years ago

lyriccoder commented 4 years ago

If we have such an example, Binary Operator instanceof doesn't have code line number (it is None):

    @Override
    public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException {
        LOGGER.log(Level.INFO, "Requested Entity: public id = {0}, system id = {1}", new Object[]{publicId, systemId});

        // We only expect a few entries here so use linear search directly.  If
        // this changes, considering caching using HashMap<String, String>
        //
        InputSource source = null;
        FileObject folder = FileUtil.getConfigFile("DTDs/GlassFish");
        if(folder != null) {
            for(FileObject fo: folder.getChildren()) {
                Object attr;
                if((attr = fo.getAttribute("publicId")) instanceof String && attr.equals(publicId)) {
                    source = new InputSource(fo.getInputStream());
                    break;
                } else if((attr = fo.getAttribute("systemId")) instanceof String && attr.equals(systemId)) {
                    source = new InputSource(fo.getInputStream());
                    break;
                }
            }
        }

        return source;
    }

In the rest of the cases, we have code line number

lyriccoder commented 4 years ago

Actually, all cases are wrong. I will reopen issue