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 - Restore Lexer.release() method
Summary: Restore Lexer.release() method
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Lexer (show other bugs)
Version: 6.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: apireviews
URL:
Keywords: API_REVIEW_FAST
: 88966 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-11-09 11:07 UTC by Miloslav Metelka
Modified: 2006-12-14 15:00 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Diff of the proposed change (21.98 KB, patch)
2006-12-07 18:00 UTC, Miloslav Metelka
Details | Diff
List of committed files (8.25 KB, text/plain)
2006-12-14 14:53 UTC, Miloslav Metelka
Details

Note You need to log in before you can comment on or make changes to this bug.
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. ***