GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remove `toLines(` and use `toContent("""` instead · Issue #1533 · diffplug/spotless

Remove toLines( and use toContent(""" instead #1533

New issue
Copy link
New issue
Copy link
Open
Open
Remove toLines( and use toContent(""" instead#1533
Copy link
Labels
enhancement

Description

@nedtwigg
nedtwigg
opened on Jan 26, 2023
Issue body actions

It would be really convenient if our tests could use multiline string literals. Then we could remove some of this cuteness

spotless/testlib/src/main/java/com/diffplug/spotless/ResourceHarness.java

Lines 184 to 186 in aa78b56

public File toLines(String... lines) {
return toContent(String.join("\n", Arrays.asList(lines)));
}

spotless/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ConfigurationCacheTest.java

Lines 50 to 61 in aa78b56

setFile("build.gradle").toLines(
"plugins {",
" id 'com.diffplug.spotless'",
"}",
"repositories { mavenCentral() }",
"apply plugin: 'java'",
"spotless {",
" java {",
" googleJavaFormat('1.2')",
" }",
"}",
"tasks.named('spotlessJavaApply').get()");

Right now we test on two platforms - jdk11 and jdk17. But once #1304 gets figured out, we could run our build on Java 17, up the source level to 17 for tests, and use Gradle toolchain to run tests against jre 11 + 17.

That might be too complicated, and java 11 LTS reaches end of life in 2026 which will be here before we know it anyway. But if you made a PR that

  • preserved the existing test matrix
  • but always used java 17 as the build jre
  • compiled bytecode to java 11 for the jars
  • compiled bytecode to java 17 for the tests

That would be welcome and quickly merged!

Reacted by Jonathan Bluett-Duncan and Benoit Chatain Lacelle

Activity

  1. nedtwigg
    added
    enhancement
    on Jan 26, 2023
  2. Goooler commented on Feb 21, 2023

    @Goooler
    Goooler
    on Feb 21, 2023
    Member
    More actions

    Use toolchains?

    https://docs.gradle.org/current/userguide/toolchains.html
    https://jakewharton.com/build-on-latest-java-test-through-lowest-java

  3. nedtwigg
    changed the title [-]Compile tests using Java 17[/-] [+]Remove `toLines(` and use `toContent("""` instead[/+] on Jul 21, 2025
  4. nedtwigg commented on Jul 21, 2025

    @nedtwigg
    nedtwigg
    on Jul 21, 2025
    MemberAuthor
    More actions

    17 is our minimum now, so this is doable. Would be nice to replace all our toLines() with toContent(""". Should be easier to read. Good job for claude to do, don't waste human time on this.

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.