Bug 238735 - NullPointerException at com.sun.tools.javac.comp.MemberEnter.complete
NullPointerException at com.sun.tools.javac.comp.MemberEnter.complete
Status: NEW
Product: java
Classification: Unclassified
Component: Compiler
8.0
All All
: P3 (vote)
: TBD
Assigned To: Dusan Balek
issues@java
EXCEPTIONS_REPORT
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-23 17:43 UTC by Maksim Khramov
Modified: 2014-04-08 20:43 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments
stacktrace (2.96 KB, text/plain)
2013-11-23 17:43 UTC, Maksim Khramov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maksim Khramov 2013-11-23 17:43:15 UTC
This bug was originally marked as duplicate of bug 217740, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE Dev (Build 201310180001)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.21-b01, Java(TM) SE Runtime Environment, 1.7.0_21-b11
OS: Windows 7

User Comments:
mkhramov: Edit java code




Stacktrace: 
java.lang.NullPointerException
   at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:1221)
   at com.sun.tools.javac.code.Symbol.complete(Symbol.java:561)
   at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1028)
   at com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:957)
   at com.sun.tools.javac.code.Symbol$TypeSymbol.getEnclosedElements(Symbol.java:735)
   at org.netbeans.api.java.source.ElementHandle.resolveImpl(ElementHandle.java:177)
Comment 1 Maksim Khramov 2013-11-23 17:43:16 UTC
Created attachment 142512 [details]
stacktrace
Comment 2 Alexander Simon 2014-04-03 10:19:11 UTC
I have the exception in the method when I copy-paste fragment:
                        while(cppTokenSequence.moveNext()) {
                        final Token<TokenId> token = cppTokenSequence.token();
                        final TokenId id = token.id();
                        if(id instanceof CppTokenId) {
of the method inside deepest if statement.
This is a text of the method after insertion:

    private TokenItem<TokenId> getTokenStream(final Document doc, final int offset) {
        final AtomicReference<TokenItem<TokenId>> out = new AtomicReference<TokenItem<TokenId>>();
        doc.render(new Runnable() {
            @Override
            public void run() {
                TokenSequence<TokenId> cppTokenSequence = CndLexerUtilities.getCppTokenSequence(doc, offset, true, true);
                if (cppTokenSequence == null) {
                    return;
                }
                if (!cppTokenSequence.language().equals(CppTokenId.languagePreproc())) {
                    return;
                }
                cppTokenSequence.moveStart();
                if (cppTokenSequence.moveNext()) {
                    while(cppTokenSequence.moveNext()) {
                        final Token<TokenId> token = cppTokenSequence.token();
                        final TokenId id = token.id();
                        if(id instanceof CppTokenId) {
                            if (CppTokenId.PREPROCESSOR_KEYWORD_DIRECTIVE_CATEGORY.equals(((CppTokenId)id).primaryCategory())) {
                                if (id == CppTokenId.PREPROCESSOR_LINE) {
                                    final int tokenOffset = cppTokenSequence.offset();
                                    TokenItem res = new TokenItem() {

                                        @Override
                                        public TokenId id() {
                                            return id;
                                        }

                                        @Override
                                        public int offset() {
                                            return tokenOffset;
                                        }

                                        @Override
                                        public CharSequence text() {
                                            return token.text();
                                        }

                                        @Override
                                        public int index() {
                                            return 0;
                                        }

                                        @Override
                                        public int length() {
                                            return text().length();
                                        }

                                        @Override
                                        public PartType partType() {
                                            return null;
                                        }
                                    };
                                    out.set(res);
                        while(cppTokenSequence.moveNext()) {
                        final Token<TokenId> token = cppTokenSequence.token();
                        final TokenId id = token.id();
                        if(id instanceof CppTokenId) {
                                    
                                    return;
                                } else {
                                    return;
                                }
                            }
                        }
                    }
                }
            }
        });
        return out.get();
    }


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo