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 89000

Summary: Restore Lexer.release() method
Product: editor Reporter: Miloslav Metelka <mmetelka>
Component: LexerAssignee: apireviews <apireviews>
Status: RESOLVED FIXED    
Severity: blocker Keywords: API_REVIEW_FAST
Priority: P2    
Version: 6.x   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: Diff of the proposed change
List of committed files

Description Miloslav Metelka 2006-11-09 11:07:47 UTC
Without it the caching of the constructed lexers cannot work (see [nbdev] Lexer
module creates instances of my lexer very often).
The release() method would be useful in case of the lexer caching like this:

public class MyJFlexLexer {
    
    private static MyJFlexLexer cached;
    
    static synchronized MyJFlexLexer create(LexerRestartInfo info) {
        MyJFlexLexer l = cached;
        if (l == null) {
            l = new MyJFlexLexer();
        }
        l.restart(info);
        return l;
    }
    
    void restart(LexerRestartInfo info) {
        // Possibly reuse other classes too and reset them with the given info
    }
    
    public void release() {
        // Possibly reset the structures that could cause memory leaks
        synchronized (MyJFlexLexer.class) {
            cached = this;
        }
    }
    
}
Comment 1 Miloslav Metelka 2006-12-07 18:00:48 UTC
Created attachment 36564 [details]
Diff of the proposed change
Comment 2 Miloslav Metelka 2006-12-07 18:02:41 UTC
Assigning for fasttrack review.
Comment 3 Jesse Glick 2006-12-07 18:37:35 UTC
'public' modifier unnecessary in interface methods.


Since this is an incompatible change, please make sure you not only update all
usages, but incr spec version of every module you changed, so as to push new
versions to AU.
Comment 4 Miloslav Metelka 2006-12-14 14:53:43 UTC
Created attachment 36668 [details]
List of committed files
Comment 5 Miloslav Metelka 2006-12-14 14:54:58 UTC
Committed in trunk.
Comment 6 Miloslav Metelka 2006-12-14 15:00:28 UTC
*** Issue 88966 has been marked as a duplicate of this issue. ***