Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments are not added to a Java document if commented line too long #3

Open
maybeec opened this issue Oct 27, 2014 · 8 comments
Open
Labels

Comments

@maybeec
Copy link
Member

maybeec commented Oct 27, 2014

Precondition is a single ('//') commented line in a Java document which nearly reaches the automatic number or characters for an automatic line break done by the eclipse formatter. Then the hook is added and destroyed as the autmatic line break will do his job and forces a line break despite the '-' sign in front of the hook. :(

When adding a multi line comment on multiple lines---all commented by ('//')---no hooks will be added at all!!!

For now I do not know how to deal with this problem... but the user can work around this issue:

!ENTRY org.eclipse.e4.ui.workbench 4 0 2013-10-17 11:13:01.792
!MESSAGE
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
    at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
    at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
    at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
    at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:285)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:504)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:555)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:376)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:322)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:84)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1056)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1081)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
    at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1108)
    at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104)
    at org.eclipse.swt.widgets.Widget.wmKeyDown(Widget.java:1827)
    at org.eclipse.swt.widgets.Control.WM_KEYDOWN(Control.java:4975)
    at org.eclipse.swt.widgets.Canvas.WM_KEYDOWN(Canvas.java:429)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4643)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:340)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:4990)
    at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: java.lang.NullPointerException
    at org.eclipse.jface.text.AbstractDocument.addPosition(AbstractDocument.java:354)
    at org.eclipse.core.internal.filebuffers.SynchronizableDocument.addPosition(SynchronizableDocument.java:236)
    at org.eclipse.jface.text.AbstractDocument.addPosition(AbstractDocument.java:376)
    at org.eclipse.jface.text.source.AnnotationModel.addPosition(AnnotationModel.java:478)
    at org.eclipse.jface.text.source.AnnotationModel.addAnnotation(AnnotationModel.java:440)
    at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider$CompilationUnitAnnotationModel.addAnnotation(CompilationUnitDocumentProvider.java:800)
    at org.eclipse.jface.text.source.AnnotationModel.addAnnotation(AnnotationModel.java:376)
    at de.tukl.cs.softech.agilereview.annotations.AgileAnnotationController.addAnnotation(AgileAnnotationController.java:95)
    at de.tukl.cs.softech.agilereview.annotations.AnnotationParser.addTagsInDocument(AnnotationParser.java:582)
    at de.tukl.cs.softech.agilereview.annotations.AnnotationParser.addTagsInDocument(AnnotationParser.java:426)
    at de.tukl.cs.softech.agilereview.views.commenttable.CommentTableView.addComment(CommentTableView.java:170)
    at de.tukl.cs.softech.agilereview.views.commenttable.handler.AddNewCommentHandler.execute(AddNewCommentHandler.java:73)
    at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290)
    at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
    ... 51 more
@maybeec maybeec added this to the v0.9.1 milestone Oct 27, 2014
@postmann
Copy link
Member

@may-bee: For Java we could check for the jdt preferences: org.eclipse.jdt.core.formatter.lineSplit gives us the maximal line length which we could use to adjust the tag location. Other languages use different formatters, so we would have to check for these as well :(

@maybeec
Copy link
Member Author

maybeec commented Oct 30, 2014

I think that would be ok for me. You can also get the maximum line range for xml documents, but I think due to the non-existence of single line comments in xml, we can ignore this. As there has not been anybody who was experiencing this behavior, it might really be a less interesting topic.
Therefore, as we now get to know this bug, lets fix it for java only.

@maybeec
Copy link
Member Author

maybeec commented Oct 30, 2014

The latter experienced behavior:

When adding a multi line comment on multiple lines---all commented by ('//')---no hooks will be added at all!!!

looks a little bit strange to me. Did you reproduce it and found the cause? Why is the parser not adding anything to the document?

@postmann
Copy link
Member

Sounds reasonable.

@postmann
Copy link
Member

Hm, in my sample code it works just fine:

/**
 * @author Peter Reuter
 *
 */
public class Test { 
    /**
     * @param args
     */
    public static void main(String[] args) {
        System.out.println("Foo");
        //      System.out.println("Foo");
        //      System.out.println("Foo");
        //      System.out.println("Foo");/*-?|Test1234|Peter Reuter|c0|*/
        //      System.out.println("Foo");
        //      System.out.println("Foo");
        //      System.out.println("Foo");
        //      System.out.println("Foo");/*-|Test1234|Peter Reuter|c0|?*/
    }
}

@maybeec
Copy link
Member Author

maybeec commented Oct 30, 2014

I think you have to add multiple maximum linesize comments

@postmann
Copy link
Member

Ok, broken, fine :) Weird stuff happening...

@maybeec
Copy link
Member Author

maybeec commented Oct 30, 2014

Weird stuff happening...

I think so :) Until now I had no idea what's going on ...
Sometimes eclipse does really strange things... especially with editors ;)

@postmann postmann modified the milestones: 0.9.2, 0.9.1 Apr 16, 2015
@postmann postmann removed this from the 0.9.2 milestone Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants