Skip to content

Commit 5748a1b

Browse files
committed
Fix compile errors with OpenJDK version of javac
1 parent 7870f9b commit 5748a1b

File tree

5 files changed

+36
-10
lines changed

5 files changed

+36
-10
lines changed

imglib2/algorithms/gpl/src/main/java/net/imglib2/algorithm/fft/FFTFunctions.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,9 @@ final private static <T extends Type<T>> void rearrangeQuadrantFFTDimZeroSingleD
651651
final int halfSizeDim = sizeDim / 2;
652652
final int sizeDimMinus1 = sizeDim - 1;
653653

654-
final T buffer = Util.getTypeFromInterval( fftImage ).createVariable();
654+
// HACK: Explicit assignment is needed for OpenJDK javac.
655+
final T fftImageType = Util.getTypeFromInterval( fftImage );
656+
final T buffer = fftImageType.createVariable();
655657

656658
final RandomAccess<T> cursor1 = fftImage.randomAccess();
657659
final RandomAccess<T> cursor2 = fftImage.randomAccess();
@@ -713,7 +715,9 @@ public void run()
713715
final int halfSizeDim = sizeDim / 2;
714716
final int sizeDimMinus1 = sizeDim - 1;
715717

716-
final T buffer = Util.getTypeFromInterval( fftImage ).createVariable();
718+
// HACK: Explicit assignment is needed for OpenJDK javac.
719+
final T fftImageType = Util.getTypeFromInterval( fftImage );
720+
final T buffer = fftImageType.createVariable();
717721

718722
final RandomAccess<T> cursor1 = fftImage.randomAccess();
719723
final RandomAccess<T> cursor2 = fftImage.randomAccess();
@@ -805,7 +809,9 @@ public void run()
805809
final int sizeDim = (int)fftImage.dimension( dim );
806810
final int halfSizeDim = sizeDim / 2;
807811

808-
final T buffer = Util.getTypeFromInterval( fftImage ).createVariable();
812+
// HACK: Explicit assignment is needed for OpenJDK javac.
813+
final T fftImageType = Util.getTypeFromInterval( fftImage );
814+
final T buffer = fftImageType.createVariable();
809815

810816
final RandomAccess<T> cursor1 = fftImage.randomAccess();
811817
final RandomAccess<T> cursor2 = fftImage.randomAccess();
@@ -897,8 +903,10 @@ public void run()
897903
final int sizeDimMinus1 = sizeDim - 1;
898904
final int halfSizeDim = sizeDim / 2;
899905

900-
final T buffer1 = Util.getTypeFromInterval( fftImage ).createVariable();
901-
final T buffer2 = Util.getTypeFromInterval( fftImage ).createVariable();
906+
// HACK: Explicit assignment is needed for OpenJDK javac.
907+
final T fftImageType = Util.getTypeFromInterval( fftImage );
908+
final T buffer1 = fftImageType.createVariable();
909+
final T buffer2 = fftImageType.createVariable();
902910

903911
final RandomAccess<T> cursor1 = fftImage.randomAccess();
904912
final RandomAccess<T> cursor2 = fftImage.randomAccess();

imglib2/algorithms/gpl/src/main/java/net/imglib2/algorithm/fft/FourierConvolution.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,10 @@ public boolean process()
270270
// instaniate real valued kernel template
271271
// which is of the same container type as the image
272272
// so that the computation is easy
273-
final Img<S> kernelTemplate = kernelImgFactory.create( kernelTemplateDim, Util.getTypeFromInterval( kernel ).createVariable() );
273+
274+
// HACK: Explicit assignment is needed for OpenJDK javac.
275+
S kernelType = Util.getTypeFromInterval( kernel );
276+
final Img<S> kernelTemplate = kernelImgFactory.create( kernelTemplateDim, kernelType.createVariable() );
274277

275278
// copy the kernel into the kernelTemplate,
276279
// the key here is that the center pixel of the kernel (e.g. 13,13,13)

imglib2/algorithms/gpl/src/main/java/net/imglib2/algorithm/fft/PhaseCorrelation.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.concurrent.atomic.AtomicInteger;
3131

3232
import net.imglib2.Cursor;
33+
import net.imglib2.ExtendedRandomAccessibleInterval;
3334
import net.imglib2.algorithm.Algorithm;
3435
import net.imglib2.algorithm.Benchmark;
3536
import net.imglib2.algorithm.MultiThreaded;
@@ -498,8 +499,11 @@ protected ArrayList<PhaseCorrelationPeak> extractPhaseCorrelationPeaks( final Im
498499
peakList.add( new PhaseCorrelationPeak( new long[ numDimensions ], -Float.MAX_VALUE) );
499500

500501
final Cursor<FloatType> cursor = invPCM.cursor();
502+
503+
// HACK: Explicit assignment is needed for OpenJDK javac.
504+
ExtendedRandomAccessibleInterval<FloatType, Img<FloatType>> extendedInvPCM = Views.extendPeriodic(invPCM);
501505
final LocalNeighborhoodCursor<FloatType> localCursor =
502-
new LocalNeighborhoodCursor<FloatType>( Views.extendPeriodic(invPCM).randomAccess(), 1 );
506+
new LocalNeighborhoodCursor<FloatType>( extendedInvPCM.randomAccess(), 1 );
503507

504508
final int[] originalOffset1 = fft1.getOriginalOffset();
505509
final int[] originalOffset2 = fft2.getOriginalOffset();

imglib2/algorithms/gpl/src/main/java/net/imglib2/algorithm/pde/ExplicitDiffusionScheme2D.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.Vector;
44

55
import net.imglib2.Cursor;
6+
import net.imglib2.ExtendedRandomAccessibleInterval;
67
import net.imglib2.RandomAccess;
78
import net.imglib2.RandomAccessibleInterval;
89
import net.imglib2.algorithm.MultiThreadedBenchmarkAlgorithm;
@@ -87,8 +88,14 @@ public boolean process() {
8788
@Override
8889
public void run() {
8990

90-
OutOfBoundsRandomAccess<T> ura = Views.extendMirrorSingle(input).randomAccess();
91-
OutOfBoundsRandomAccess<FloatType> dra = Views.extendMirrorSingle(D).randomAccess();
91+
// HACK: Explicit assignment is needed for OpenJDK javac.
92+
ExtendedRandomAccessibleInterval<T, Img<T>> extendedInput = Views.extendMirrorSingle(input);
93+
OutOfBoundsRandomAccess<T> ura = extendedInput.randomAccess();
94+
95+
// HACK: Explicit assignment is needed for OpenJDK javac.
96+
ExtendedRandomAccessibleInterval<FloatType, RandomAccessibleInterval<FloatType>> extendedD = Views.extendMirrorSingle(D);
97+
OutOfBoundsRandomAccess<FloatType> dra = extendedD.randomAccess();
98+
9299
Cursor<FloatType> incrementCursor = increment.localizingCursor();
93100

94101
long[] position = new long[input.numDimensions()];

imglib2/algorithms/gpl/src/main/java/net/imglib2/algorithm/pde/PeronaMalikAnisotropicDiffusion.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.Vector;
2929

3030
import net.imglib2.Cursor;
31+
import net.imglib2.ExtendedRandomAccessibleInterval;
3132
import net.imglib2.RandomAccess;
3233
import net.imglib2.algorithm.MultiThreadedBenchmarkAlgorithm;
3334
import net.imglib2.algorithm.region.localneighborhood.LocalNeighborhoodCursor;
@@ -168,7 +169,10 @@ public void run() {
168169
long[] position = new long[image.numDimensions()];
169170
Cursor<FloatType> incrementCursor = increment.localizingCursor();
170171
RandomAccess<T> ra = image.randomAccess();
171-
LocalNeighborhoodCursor<T> neighborhoodCursor = new LocalNeighborhoodCursor<T>(Views.extendMirrorSingle(image), centralPosition);
172+
173+
// HACK: Explicit assignment is needed for OpenJDK javac.
174+
ExtendedRandomAccessibleInterval<T, Img<T>> extendedImage = Views.extendMirrorSingle(image);
175+
LocalNeighborhoodCursor<T> neighborhoodCursor = new LocalNeighborhoodCursor<T>(extendedImage, centralPosition);
172176

173177
incrementCursor.jumpFwd(chunk.getStartPosition());
174178

0 commit comments

Comments
 (0)