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 - parentheses in expressions created by TreeMaker
Summary: parentheses in expressions created by TreeMaker
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Rastislav Komara
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-25 21:54 UTC by tronicek
Modified: 2009-02-19 21:09 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

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