Bndtools: New Quick Fixes

The current Bndtools 7.1.0-SNAPSHOT Eclipse Plugin has recently received a number of new quick fixes. Before we finalize them, it would be nice to get some feedback how they work in practice.

Without further ado, let’s dive into them.

Binary, Hex, Separators

Maybe it is me, but in the embedded world hex and binary are often used. So you an now you can easily convert decimal to hex and binary and hex and binary to decimal.



Originally I added a version bump in a special refactoring for the file. However, then I realized this could also be useful in other source files.


Strings & Text Blocks

Make string upper case or lower case; convert strings to text blocks and text blocks to strings


Constructor Assignment

Methods and constructors get a quick fix to assign a parameter to a field. However, this parameter is private. Personally I do not think class private is very useful (package private suffices for me and it makes testing easier). Then again, I am going out of my way nowadays to make fields final. So I added a fix to assign a parameter to a final field.

Turning Private into final

As stated, I really don’t like final. I know it helps to find unused fields but that is just a limitation of the compiler, you could also provide this information on package level. Less is more and private takes real estate and imho provides no value. Therefore a quick fix to change private field to final!

Export a package

If you have a file, you can now export it.

If you do not have a file, you can now create it with File/New.

Declarative Services

You can now add all the Declarative Services/Component annotations with quick fixes.

Gogo Commands

In a recent version Gogo added an annotation @GogoCommand that simplifies making a component that can provide Gogo commands. The quick fixes for the Gogo Command assume that methods with the @Descriptor annotation are commands. It will assemble the hard to maintain function annotation field for you.


It can also add a @Parameter annotation all filed in:


Oh, yeah. It can also clean up:



You can now expand the selection to the type the cursor is in. If the cursor is on a method declaration, it will select the whole method. If it is on a class declaration it will select the class. This makes it simpler to copy a part of the source code without having to chase the proper closing bracket.


Open AI

Unless you’ve been living under a rock you are aware that AI is going to revolutionize the software world. I already had been dabbling in. As an experiment, I’ve added an AI dialog to the quick fixes. It will copy the current node to a OpenAI dialog and then allows you to tell it to change the code.


The OpenAI quick fix is only available if you set an OpenAI API key. This can be done with the following bnd command:

bnd settings openai.apikey=sk-...hqyl


This is preliminary code. Quick fixes are good when you need them but unnecessary quick fixes become annoying when they are in your face. For this reason, I need feedback how they work in practice.

The OpenAI stuff is highly experimental. I am aware there is another AI assistant available for Eclipse now but I think it is worth to expand the usage of AI to bndtools. The current implementation is very much generic Java but I think AI could really help with debugging the resolving and doing things in the bnd file.

Again, feedback on this is needed. I am open to spend some significant time to make this a really cool tool if I get some engagement.

Last point. I’ve spent significant effort to make the refactoring a lot easier. If you’re interested in quickfix/refactoring support for your company annotations, let me know. I am looking for some new customers :slight_smile:

1 Like

Not exactly related to quick fix , but close and I though worth sharing:
I just found out today that there is a subtle difference in the keyboard shortcuts for code completion:

Control + Space vs. Control + Shift + Space
⌃␣ vs. ⌃⇧␣

I think the ChatGPT explanation is good in this regard:

In Eclipse, there is indeed a subtle yet important difference between using Control + Space and Control + Shift + Space for code completion:

  1. Control + Space: This is the standard code completion shortcut. It triggers a context-sensitive dropdown list of suggestions that includes methods, variables, and other relevant code snippets based on the current context. For instance, if you start typing the name of a variable or a method, this shortcut will bring up a list of matching names that you can quickly select from.
  2. Control + Shift + Space: This key combination is often used for what’s called “smart type-aware code completion.” The difference lies in its “type-aware” aspect. When you use this shortcut, Eclipse not only looks at the immediate context but also considers the expected type of the expression. For example, if you’re writing a method call and you’ve typed the method name followed by an open parenthesis, using Control + Shift + Space will suggest parameters that match the expected type for the current argument position. It’s particularly useful for filling in method arguments because it filters the suggestions to only those that are type-compatible with the expected parameter.

In summary, while both shortcuts are used for code completion, Control + Shift + Space is more contextually advanced, offering suggestions that are more finely tailored to the expected types and method signatures based on the current coding context.

Control + Shift + Space is what I was looking for, because it helps to see the tooltip with the parameters of a method (and the current parameter highlighted) like this:

Usually this appears also with Control + Space too when you start typing the method, but only if you continuously type. BUT in case you leave with the cursor to another place in the middle of typing, this little helper is gone, and I couldn’t find a way to get it back at the cursor position. Until I found Control + Shift + Space :slight_smile:

1 Like

Every time I work with people that use Eclipse there are always new tips exchanged. Thanks, useful.

1 Like