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 157412

Summary: parentheses in expressions created by TreeMaker
Product: java Reporter: tronicek <tronicek>
Component: SourceAssignee: Rastislav Komara <moonko>
Status: NEW ---    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description tronicek 2009-01-25 21:54:33 UTC
When I create an ExpressionTree for 1 & (2 & (3 & 4)), i.e. (make is of type TreeMaker)

            BinaryTree b = make.Binary(Kind.AND,
                    make.Literal(Integer.valueOf(1)),
                    make.Binary(Kind.AND,
                        make.Literal(Integer.valueOf(2)),
                            make.Binary(Kind.AND,
                                make.Literal(Integer.valueOf(3)),
                                make.Literal(Integer.valueOf(4)))));

and insert it into the source code, it is inserted WITHOUT parentheses, i.e. 1 & 2 & 3 & 4 is inserted.
Comment 1 Jan Lahoda 2009-02-02 11:24:05 UTC
Currently, the clients of TreeMaker are expected to create tree structure matching exactly the tree that would be
created by the parser for the desired output, including required make.Parenthesis. I agree that the behavior is not very
intuitive in the above case. It might be possible to improve the situation - this should be investigated. Does not
qualify as a defect IMO.
Comment 2 Rastislav Komara 2009-02-03 10:55:38 UTC
Overtake.