Skip to content

Formatting of comments is not hermetic #1221

Closed

Description

@raviagarwal7

Given the below java code, the formatting output is not hermetic, i.e the output changes on subsequent run

  • Initial Java Class
package com.test;

@Application()
@Configuration(exclude = {SomeVeryVeryVeryVeryVeryVeryLongClassName.class}) // abcde abcedfg ab abcdefghijklm abcd abc abcd abcd abcdef abcdefghij abc abc ab ab abcdefghij
public class TestClass {}
  • After first formatting run
package com.test;

@Application()
@Configuration(
    exclude = {
      SomeVeryVeryVeryVeryVeryVeryLongClassName.class
    }) // abcde abcedfg ab abcdefghijklm abcd abc abcd abcd abcdef abcdefghij abc abc ab ab
       // abcdefghij
public class TestClass {}
  • After second formatting run
package com.test;

@Application()
@Configuration(
    exclude = {
      SomeVeryVeryVeryVeryVeryVeryLongClassName.class
    }) // abcde abcedfg ab abcdefghijklm abcd abc abcd abcd abcdef abcdefghij abc abc ab ab
// abcdefghij
public class TestClass {}

the comment part of // abcdefghij is moved to column 0

This issue happens when GJF is run with or without --skip-reflowing-long-strings flag.

Activity

  1. cushon commented on Mar 14, 2025

    @cushon
    Collaborator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions