Re: Possible code clean-up
ср, 30 июн. 2021 г. в 18:26, Christopher Schultz : > > All, > > On 6/30/21 11:23, Christopher Schultz wrote: > > Mark, > > > > On 6/30/21 08:51, Mark Thomas wrote: > >> All, > >> > >> I wanted to get some feedback on a possible code clean-up. Currently, > >> we declare literal arrays like this: > >> > >> String[] array = new String[] { "value1", "value2", "value3" ); > >> > >> We could simplify these declarations to: > >> > >> String[] array = { "value1", "value2", "value3" ); > >> > >> [...] > > > > Hmm. Is there a minimum compiler version necessary to use that syntax? > > I've literally never seen it before. Maybe it's just always been there... > > Been there forever: > http://titanium.cs.berkeley.edu/doc/java-langspec-1.0/10.doc.html#11358 I also wondered. Just tested that it works with Java 6. More examples here: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html +1 to simplify. Best regards, Konstantin Kolinko - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Possible code clean-up
All, On 6/30/21 11:23, Christopher Schultz wrote: Mark, On 6/30/21 08:51, Mark Thomas wrote: All, I wanted to get some feedback on a possible code clean-up. Currently, we declare literal arrays like this: String[] array = new String[] { "value1", "value2", "value3" ); We could simplify these declarations to: String[] array = { "value1", "value2", "value3" ); There doesn't appear to be a checkstyle rule to enforce one approach or the other. Assuming someone is willing to spend the time to make these changes what do the folks here think? I think the code is a little cleaner and therefore easier to read but the benefit seems minimal. I'm not sure it is worth "fixing" the existing code. We could use this going forward as the opportunity arises. The inconsistency in style bugs me a little - but not so much I couldn't live with it. Thoughts? Hmm. Is there a minimum compiler version necessary to use that syntax? I've literally never seen it before. Maybe it's just always been there... Been there forever: http://titanium.cs.berkeley.edu/doc/java-langspec-1.0/10.doc.html#11358 +0 for me, I guess -chris - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Possible code clean-up
Mark, On 6/30/21 08:51, Mark Thomas wrote: All, I wanted to get some feedback on a possible code clean-up. Currently, we declare literal arrays like this: String[] array = new String[] { "value1", "value2", "value3" ); We could simplify these declarations to: String[] array = { "value1", "value2", "value3" ); There doesn't appear to be a checkstyle rule to enforce one approach or the other. Assuming someone is willing to spend the time to make these changes what do the folks here think? I think the code is a little cleaner and therefore easier to read but the benefit seems minimal. I'm not sure it is worth "fixing" the existing code. We could use this going forward as the opportunity arises. The inconsistency in style bugs me a little - but not so much I couldn't live with it. Thoughts? Hmm. Is there a minimum compiler version necessary to use that syntax? I've literally never seen it before. Maybe it's just always been there... -chris - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Possible code clean-up
On Wed, Jun 30, 2021 at 3:51 PM Mark Thomas wrote: > All, > > I wanted to get some feedback on a possible code clean-up. Currently, we > declare literal arrays like this: > > String[] array = new String[] { "value1", "value2", "value3" ); > > We could simplify these declarations to: > > String[] array = { "value1", "value2", "value3" ); > > There doesn't appear to be a checkstyle rule to enforce one approach or > the other. > > Assuming someone is willing to spend the time to make these changes what > do the folks here think? > > I think the code is a little cleaner and therefore easier to read but > the benefit seems minimal. I'm not sure it is worth "fixing" the > existing code. > > We could use this going forward as the opportunity arises. The > inconsistency in style bugs me a little - but not so much I couldn't > live with it. > > Thoughts? > +1 to simplify ! > > Mark > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > >
Possible code clean-up
All, I wanted to get some feedback on a possible code clean-up. Currently, we declare literal arrays like this: String[] array = new String[] { "value1", "value2", "value3" ); We could simplify these declarations to: String[] array = { "value1", "value2", "value3" ); There doesn't appear to be a checkstyle rule to enforce one approach or the other. Assuming someone is willing to spend the time to make these changes what do the folks here think? I think the code is a little cleaner and therefore easier to read but the benefit seems minimal. I'm not sure it is worth "fixing" the existing code. We could use this going forward as the opportunity arises. The inconsistency in style bugs me a little - but not so much I couldn't live with it. Thoughts? Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org