jaxb-codemodel icon indicating copy to clipboard operation
jaxb-codemodel copied to clipboard

Extra space in extends clause when inheriting from nested class which enclosing class ends on digit.

Open glassfishrobot opened this issue 11 years ago • 3 comments

Codemodel 2.6 adds an extra space before the dot (EnclosingClass .NestedClass) in extends statement when class is inherited from EnclosingClass.NestedClass and EnclosingClass class name ends on the digit. I.e.: public class EncDefClass1NestedClassChild extends out.EncDefClass1 .NestedClass {} ^^^ This happens both when inheriting from the JDefinedClass and class by reference.

Environment

Windows XP, Netbeans 6.7.1

Affected Versions

[2.6]

glassfishrobot avatar Jan 18 '14 16:01 glassfishrobot

Reported by vic123

glassfishrobot avatar Jan 18 '14 16:01 glassfishrobot

vic123 said: Rough perl workaround (sorry for now - have posted before finding out that cannot format it well):

use strict; use warnings; use File::Find qw(find); use Cwd; use URI;

my $pwd = cwd()."/"; my $dir = $ARGV[0]; my $pattern = '.*java'; find sub

{removeExtraSpaceFromExtendsFromNestedClass($File::Find::name) if /$pattern/}

, $dir;

sub removeExtraSpaceFromExtendsFromNestedClass

{ undef $/; my ($f_path) = @_; my $f_absuri = URI->new($f_path)->abs($pwd); print $f_absuri."\n"; open(INFI, "<", $f_absuri) || die("can't open ".$f_absuri.": $!"); my $data = <INFI>; $data =~ s/^(\s*)extends\s+([^\s]+)\s.([^\s]+)\s*$/$1extends $2.$3/gxm; close INFI; open(OUTF, ">", $f_absuri) || die("can't open ".$f_absuri.": $!"); print OUTF $data; }

glassfishrobot avatar Jan 18 '14 21:01 glassfishrobot

This issue was imported from java.net JIRA CODEMODEL-22

glassfishrobot avatar Apr 24 '17 07:04 glassfishrobot