This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 238735 - NullPointerException at com.sun.tools.javac.comp.MemberEnter.complete
Summary: NullPointerException at com.sun.tools.javac.comp.MemberEnter.complete
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Compiler (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
: 248957 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-11-23 17:43 UTC by Maksim Khramov
Modified: 2016-07-07 07:18 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 205518


Attachments
stacktrace (2.96 KB, text/plain)
2013-11-23 17:43 UTC, Maksim Khramov
Details
stacktrace (4.16 KB, text/plain)
2014-09-02 13:32 UTC, Alexander Simon
Details
stacktrace (4.87 KB, text/plain)
2014-09-19 11:21 UTC, Exceptions Reporter
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();
    }
Comment 3 Alexander Simon 2014-09-02 13:32:03 UTC
Created attachment 149003 [details]
stacktrace

edit java file
Comment 4 Exceptions Reporter 2014-09-02 13:32:09 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=205518
Comment 5 Exceptions Reporter 2014-09-19 11:21:21 UTC
Created attachment 149366 [details]
stacktrace

Nullpointer Exception occurred when running
Comment 6 Dusan Balek 2014-11-28 09:20:08 UTC
*** Bug 248957 has been marked as a duplicate of this bug. ***
Comment 7 Martin Balin 2016-07-07 07:18:17 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss