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 186035 - Formatting method call named "delete" causes formatting problems
Summary: Formatting method call named "delete" causes formatting problems
Status: VERIFIED FIXED
Alias: None
Product: javafx
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Anton Chechel
URL:
Keywords:
Depends on:
Blocks: 173487
  Show dependency tree
 
Reported: 2010-05-12 16:27 UTC by Torbjorn Norbye
Modified: 2010-05-17 08:22 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Torbjorn Norbye 2010-05-12 16:27:50 UTC
We have a method which is named "delete" that we're trying to call from JavaFX.

The SAFE way to do this is to surround the call with <<>>'s, and that works fine.

It turns out the compiler doesn't insist on this when it's obvious you're referring to an API method, so this is valid JavaFX:

    foo.delete();

If I format code which contains this, then bad formatting happens:

Sample:

class Foo {
    public function <<delete>>(): Void {
        println("test");
    }
}
Foo{}.delete();
Rectangle{}

Formatting gives this:

class Foo {
    public function <<delete>>(): Void {
        println("test");
    }

}

Foo {}.

 delete();
Rectangle{}

(It doesn't looks so bad here -- in my real world case the code was indented more, so I ended up with a screenful of newlines).
Comment 1 Torbjorn Norbye 2010-05-12 17:26:41 UTC
I filed this as a P4, but I noticed we have quite a few cases of this in our codebase. There are Java APIs that are named delete. If I use code completion in FX I end up with a call without <<>>'s.

def file = new java.io.File(path);
file.delete();

(1) We should probably insert <<>>'s when the method you're inserting is a keyword.

(2) The formatter should probably handle this specific case (when the usage is clearly an identifier name, not its keyword usage).
Comment 2 Anton Chechel 2010-05-13 16:27:23 UTC
fixed
http://hg.netbeans.org/javafx/rev/c57c0f0f7dd7

But I still don't understand why do you need FX function to be named by FX keyword? If you invoke java function from FX code you don't need that crazy "<<>>" signs...
Comment 3 Alexandr Scherbatiy 2010-05-17 08:22:34 UTC
verified in NetBeans-JavaFX-Soma: #253