-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ignore private methods and non-settable properties (#27)
Stricter filtering on what is and isn't settable.
- Loading branch information
1 parent
df9d3e2
commit 40aefda
Showing
6 changed files
with
117 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
auto-parallelizable/src/test/resources/abstract/input/Abstract.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* (c) Copyright 2023 Palantir Technologies Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package app; | ||
|
||
import com.palantir.gradle.autoparallelizable.AutoParallelizable; | ||
import org.gradle.api.provider.ListProperty; | ||
import org.gradle.api.provider.MapProperty; | ||
import org.gradle.api.provider.Property; | ||
import org.gradle.api.provider.SetProperty; | ||
import org.gradle.api.tasks.Nested; | ||
|
||
@AutoParallelizable | ||
public final class Abstract { | ||
public abstract class AbstractTask extends AbstractTaskImpl { | ||
public AbstractTask() { | ||
setDescription("lol"); | ||
} | ||
} | ||
|
||
interface Nested { | ||
public Property<String> getString(); | ||
} | ||
|
||
abstract static class AbstractParams { | ||
public abstract Property<String> getSettableNonNestedString(); | ||
|
||
public abstract Property<String> getStringWithParameters(String parameter); | ||
|
||
private Property<String> getPrivateProperty() { | ||
return null; | ||
} | ||
|
||
public abstract Nested getNonNestedNonSettableProperty(); | ||
} | ||
|
||
interface Params { | ||
@org.gradle.api.tasks.Nested | ||
AbstractParams getAbstractParams(); | ||
} | ||
|
||
static void action(Params params) { | ||
System.out.println("Hello " | ||
+ params.getAbstractParams().getSettableNonNestedString().get()); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
auto-parallelizable/src/test/resources/abstract/output/AbstractTaskImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package app; | ||
|
||
import javax.annotation.processing.Generated; | ||
import javax.inject.Inject; | ||
import org.gradle.api.DefaultTask; | ||
import org.gradle.api.tasks.TaskAction; | ||
import org.gradle.workers.WorkerExecutor; | ||
|
||
@Generated("com.palantir.gradle.autoparallelizable.AutoParallelizableProcessor") | ||
abstract class AbstractTaskImpl extends DefaultTask implements Abstract.Params { | ||
@Inject | ||
protected abstract WorkerExecutor getWorkerExecutor(); | ||
|
||
@TaskAction | ||
public final void execute() { | ||
getWorkerExecutor().noIsolation().submit(AbstractWorkAction.class, params -> { | ||
params.getAbstractParams() | ||
.getSettableNonNestedString() | ||
.set(this.getAbstractParams().getSettableNonNestedString()); | ||
}); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
auto-parallelizable/src/test/resources/abstract/output/AbstractWorkAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package app; | ||
|
||
import javax.annotation.processing.Generated; | ||
import org.gradle.workers.WorkAction; | ||
|
||
@Generated("com.palantir.gradle.autoparallelizable.AutoParallelizableProcessor") | ||
abstract class AbstractWorkAction implements WorkAction<AbstractWorkParams> { | ||
@SuppressWarnings("RedundantModifier") | ||
public AbstractWorkAction() {} | ||
|
||
@Override | ||
public final void execute() { | ||
Abstract.action(getParameters()); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
auto-parallelizable/src/test/resources/abstract/output/AbstractWorkParams.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package app; | ||
|
||
import javax.annotation.processing.Generated; | ||
import org.gradle.workers.WorkParameters; | ||
|
||
@Generated("com.palantir.gradle.autoparallelizable.AutoParallelizableProcessor") | ||
interface AbstractWorkParams extends WorkParameters, Abstract.Params {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: improvement | ||
improvement: | ||
description: Stricter filtering on what is and isn't settable. | ||
links: | ||
- https://github.com/palantir/auto-parallelizable/pull/27 |