ByteArrayOutputStream should not have a new writeBytes method in Java

Tagir Valeev amaembo at gmail.com
Fri Sep 28 04:51:50 UTC 2018


Hello!

I can volunteer doing this if OpenJDK community is really interested.
I've launched the inspection over all java.* and jdk.* modules and
found 4064 warnings.
As an example, I converted all C-style array declarations in java.base
module (660 warnings in 168 files). Here's the webrev:
http://cr.openjdk.java.net/~tvaleev/patches/array_decl_java_base/

To me it's easier to review the whole patch rather than click on every file:
http://cr.openjdk.java.net/~tvaleev/patches/array_decl_java_base/jdk.patch

I checked the result by eyes thoroughly and did not find anything
wrong. So if you're interested I can prepare a patch which covers any
full JDK sources or any subset of it.
The only questions are which subset should be processed and should I
also update copyrights for changed files (doing this automatically
could be more risky unless there's
already well-tested utility to do this).

With best regards,
Tagir Valeev.


On Thu, Sep 13, 2018 at 8:02 AM Stuart Marks <stuart.marks at oracle.com> wrote:
>
> Cool, I didn't know that IntelliJ IDEA has such an inspection, but I'm not
> surprised.
>
> Perhaps a volunteer can run this inspection over parts of the JDK code base and
> see what comes up, and possibly propose some patches. :-)
>
> s'marks
>
>
> On 9/11/18 10:34 PM, Tomasz Linkowski wrote:
> > Hello Stuart,
> >
> > I'm not sure whether you're aware that IntelliJ IDEA has an automatic
> > inspection named "C-style array declaration":
> > - description:
> > https://github.com/JetBrains/intellij-community/blob/master/plugins/InspectionGadgets/src/inspectionDescriptions/CStyleArrayDeclaration.html
> > - logic:
> > https://github.com/JetBrains/intellij-community/blob/master/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/CStyleArrayDeclarationInspection.java
> >
> > You can run such single inspection over the entire project as described here:
> > https://www.jetbrains.com/help/idea/running-inspection-by-name.html
> >
> > It will fix all such C-style array declarations for you automatically.
> >
> > --
> > Regards,
> > Tomasz Linkowski
> >
> >
> >     From: Stuart Marks <stuart.marks at oracle.com <mailto:stuart.marks at oracle.com>>
> >     To: "ullenboom at gmail.com <mailto:ullenboom at gmail.com>"
> >     <ullenboom at gmail.com <mailto:ullenboom at gmail.com>>
> >     Cc: "core-libs-dev at openjdk.java.net
> >     <mailto:core-libs-dev at openjdk.java.net>" <core-libs-dev at openjdk.java.net
> >     <mailto:core-libs-dev at openjdk.java.net>>
> >     Bcc:
> >     Date: Tue, 11 Sep 2018 13:23:41 -0700
> >     Subject: Re: ByteArrayOutputStream should not have a new writeBytes method
> >     in Java 11
> >
> >     2. even if, it should not be byte b[] but byte[] b
> >
> >
> >     Yeah we need to clean occurrences of this anachronistic array declaration
> >     from the JDK. I noticed a few others nearby. It's startling that a new
> >     occurrence has crept it. (Or maybe not, perhaps it was done to conform to
> >     the nearby code.)
> >
> >
> >     Any volunteers to clean this up?
> >
> >
> >     An interesting exercise would be to write a detector for this declaration
> >     style.
> >
> >
> >     s'marks
> >
>


More information about the core-libs-dev mailing list