pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1867389 - in /pdfbox/branches/issue4569: debugger/src/main/java/org/apache/pdfbox/debugger/ui/ fontbox/src/main/java/org/apache/fontbox/ttf/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/com...
Date Mon, 23 Sep 2019 18:13:36 GMT
Author: tilman
Date: Mon Sep 23 18:13:36 2019
New Revision: 1867389

URL: http://svn.apache.org/viewvc?rev=1867389&view=rev
Log:
PDFBOX-4071: use jdk8 lambda expressions

Modified:
    pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ErrorDialog.java
    pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/Tree.java
    pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ViewMenu.java
    pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java
    pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/OpenTypeScript.java
    pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java
    pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabels.java
    pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineNode.java
    pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java

Modified: pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ErrorDialog.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ErrorDialog.java?rev=1867389&r1=1867388&r2=1867389&view=diff
==============================================================================
--- pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ErrorDialog.java
(original)
+++ pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ErrorDialog.java
Mon Sep 23 18:13:36 2019
@@ -20,7 +20,6 @@ import java.awt.Component;
 import java.awt.Dimension;
 import java.awt.Point;
 import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
 import java.util.Arrays;
@@ -152,52 +151,44 @@ public class ErrorDialog extends JDialog
     final JComponent createContent()
     {
         final JButton showDetails = new JButton("Show Details >>");
-        showDetails.addActionListener(new ActionListener()
+        showDetails.addActionListener(e ->
         {
-            @Override
-            public void actionPerformed(ActionEvent e)
+            if (showingDetails)
             {
-                if (showingDetails)
-                {
-                    main.remove(details);
-                    main.validate();
-                    main.setPreferredSize(MESSAGE_SIZE);
-                }
-                else
+                main.remove(details);
+                main.validate();
+                main.setPreferredSize(MESSAGE_SIZE);
+            }
+            else
+            {
+                if (details == null)
                 {
-                    if (details == null)
-                    {
-                        details = createDetailedMessage(error);
-                        StringBuilder buffer = new StringBuilder();
-                        stacktrace.setText(generateStackTrace(error, buffer).toString());
-                        stacktrace.setCaretPosition(0);
-                        stacktrace.setBackground(main.getBackground());
-                        stacktrace.setPreferredSize(STACKTRACE_SIZE);
-                    }
-                    main.add(details, BorderLayout.CENTER);
-                    main.validate();
-                    main.setPreferredSize(TOTAL_SIZE);
+                    details = createDetailedMessage(error);
+                    StringBuilder buffer = new StringBuilder();
+                    stacktrace.setText(generateStackTrace(error, buffer).toString());
+                    stacktrace.setCaretPosition(0);
+                    stacktrace.setBackground(main.getBackground());
+                    stacktrace.setPreferredSize(STACKTRACE_SIZE);
                 }
-                showingDetails = !showingDetails;
-                showDetails.setText(showingDetails ? "<< Hide Details" : "Show Details
>>");
-                ErrorDialog.this.pack();
+                main.add(details, BorderLayout.CENTER);
+                main.validate();
+                main.setPreferredSize(TOTAL_SIZE);
             }
+            showingDetails = !showingDetails;
+            showDetails.setText(showingDetails ? "<< Hide Details" : "Show Details
>>");
+            ErrorDialog.this.pack();
         });
         JPanel messagePanel = new JPanel();
 
         final JCheckBox filter = new JCheckBox("Filter stack traces");
         filter.setSelected(isFiltering);
-        filter.addActionListener(new ActionListener()
+        filter.addActionListener(e ->
         {
-            @Override
-            public void actionPerformed(ActionEvent e)
-            {
-                isFiltering = filter.isSelected();
-                StringBuilder buffer = new StringBuilder();
-                stacktrace.setText(generateStackTrace(error, buffer).toString());
-                stacktrace.setCaretPosition(0);
-                stacktrace.repaint();
-            }
+            isFiltering = filter.isSelected();
+            StringBuilder buffer = new StringBuilder();
+            stacktrace.setText(generateStackTrace(error, buffer).toString());
+            stacktrace.setCaretPosition(0);
+            stacktrace.repaint();
         });
         message.setBackground(messagePanel.getBackground());
         JPanel buttonPanel = new JPanel();
@@ -216,14 +207,7 @@ public class ErrorDialog extends JDialog
         panel.add(messagePanel, BorderLayout.NORTH);
         
         // allow closing with ESC
-        ActionListener actionListener = new ActionListener()
-        {
-            @Override
-            public void actionPerformed(ActionEvent actionEvent)
-            {
-                dispose();
-            }
-        };
+        ActionListener actionListener = actionEvent -> dispose();
         KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
         panel.registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
       
         
@@ -292,13 +276,6 @@ public class ErrorDialog extends JDialog
      */
     private boolean isSuppressed(String className)
     {
-        for (String s : FILTERS)
-        {
-            if (className.startsWith(s))
-            {
-                return true;
-            }
-        }
-        return false;
+        return FILTERS.stream().anyMatch(s -> className.startsWith(s));
     }
 }

Modified: pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/Tree.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/Tree.java?rev=1867389&r1=1867388&r2=1867389&view=diff
==============================================================================
--- pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/Tree.java
(original)
+++ pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/Tree.java
Mon Sep 23 18:13:36 2019
@@ -36,8 +36,6 @@ import java.awt.Point;
 import java.awt.Toolkit;
 import java.awt.datatransfer.Clipboard;
 import java.awt.datatransfer.StringSelection;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
 import java.awt.event.MouseEvent;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -118,10 +116,7 @@ public class Tree extends JTree
         {
             if (stream.getFilters() instanceof COSArray && ((COSArray) stream.getFilters()).size()
>= 2)
             {
-                for (JMenuItem menuItem : getPartiallyDecodedStreamSaveMenu(stream))
-                {
-                    treePopupMenu.add(menuItem);
-                }
+                getPartiallyDecodedStreamSaveMenu(stream).forEach(menuItem -> treePopupMenu.add(menuItem));
             }
             treePopupMenu.add(getRawStreamSaveMenu(stream));
         }
@@ -142,14 +137,10 @@ public class Tree extends JTree
     private JMenuItem getTreePathMenuItem(final TreePath path)
     {
         JMenuItem copyPathMenuItem = new JMenuItem("Copy Tree Path");
-        copyPathMenuItem.addActionListener(new ActionListener()
+        copyPathMenuItem.addActionListener(actionEvent ->
         {
-            @Override
-            public void actionPerformed(ActionEvent actionEvent)
-            {
-                Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
-                clipboard.setContents(new StringSelection(new TreeStatus(rootNode).getStringForPath(path)),
null);
-            }
+            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+            clipboard.setContents(new StringSelection(new TreeStatus(rootNode).getStringForPath(path)),
null);
         });
         return copyPathMenuItem;
     }
@@ -162,20 +153,16 @@ public class Tree extends JTree
     private JMenuItem getRawStreamSaveMenu(final COSStream cosStream)
     {
         JMenuItem saveMenuItem = new JMenuItem("Save Raw Stream (" + getFilters(cosStream)
+ ") As...");
-        saveMenuItem.addActionListener(new ActionListener()
+        saveMenuItem.addActionListener(actionEvent ->
         {
-            @Override
-            public void actionPerformed(ActionEvent actionEvent)
+            try
             {
-                try
-                {
-                    byte[] bytes = IOUtils.toByteArray(cosStream.createRawInputStream());
-                    saveStream(bytes, null, null);
-                }
-                catch (IOException e)
-                {
-                    e.printStackTrace();
-                }
+                byte[] bytes = IOUtils.toByteArray(cosStream.createRawInputStream());
+                saveStream(bytes, null, null);
+            }
+            catch (IOException e)
+            {
+                e.printStackTrace();
             }
         });
         return saveMenuItem;
@@ -248,20 +235,16 @@ public class Tree extends JTree
         }
 
         JMenuItem saveMenuItem = new JMenuItem("Save Stream As" + format + "...");
-        saveMenuItem.addActionListener(new ActionListener()
+        saveMenuItem.addActionListener(actionEvent ->
         {
-            @Override
-            public void actionPerformed(ActionEvent actionEvent)
+            try
             {
-                try
-                {
-                    byte[] bytes = IOUtils.toByteArray(cosStream.createInputStream());
-                    saveStream(bytes, fileFilter, extension);
-                }
-                catch (IOException e)
-                {
-                    e.printStackTrace();
-                }
+                byte[] bytes = IOUtils.toByteArray(cosStream.createInputStream());
+                saveStream(bytes, fileFilter, extension);
+            }
+            catch (IOException e)
+            {
+                e.printStackTrace();
             }
         });
         return saveMenuItem;
@@ -299,27 +282,23 @@ public class Tree extends JTree
         }
 
         JMenuItem openMenuItem = new JMenuItem("Open with Default Application");
-        openMenuItem.addActionListener(new ActionListener()
+        openMenuItem.addActionListener(actionEvent ->
         {
-            @Override
-            public void actionPerformed(ActionEvent actionEvent)
+            try
             {
-                try
+                File temp = File.createTempFile("pdfbox", "." + extension);
+                temp.deleteOnExit();
+                
+                try (InputStream is = cosStream.createInputStream();
+                        FileOutputStream os = new FileOutputStream(temp))
                 {
-                    File temp = File.createTempFile("pdfbox", "." + extension);
-                    temp.deleteOnExit();
-
-                    try (InputStream is = cosStream.createInputStream();
-                         FileOutputStream os = new FileOutputStream(temp))
-                    {
-                        IOUtils.copy(is, os);
-                    }
-                    Desktop.getDesktop().open(temp);
-                }
-                catch (IOException e)
-                {
-                    e.printStackTrace();
+                    IOUtils.copy(is, os);
                 }
+                Desktop.getDesktop().open(temp);
+            }
+            catch (IOException e)
+            {
+                e.printStackTrace();
             }
         });
         return openMenuItem;
@@ -359,20 +338,16 @@ public class Tree extends JTree
         nameListBuilder.delete(nameListBuilder.lastIndexOf("&"), nameListBuilder.length());
         JMenuItem menuItem = new JMenuItem("Keep " + nameListBuilder.toString() + "...");
 
-        menuItem.addActionListener(new ActionListener()
+        menuItem.addActionListener(actionEvent ->
         {
-            @Override
-            public void actionPerformed(ActionEvent actionEvent)
+            try
             {
-                try
-                {
-                    InputStream data = stream.createInputStream(stopFilters);
-                    saveStream(IOUtils.toByteArray(data), null, null);
-                }
-                catch (IOException e)
-                {
-                    e.printStackTrace();
-                }
+                InputStream data = stream.createInputStream(stopFilters);
+                saveStream(IOUtils.toByteArray(data), null, null);
+            }
+            catch (IOException e)
+            {
+                e.printStackTrace();
             }
         });
         return menuItem;

Modified: pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ViewMenu.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ViewMenu.java?rev=1867389&r1=1867388&r2=1867389&view=diff
==============================================================================
--- pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ViewMenu.java
(original)
+++ pdfbox/branches/issue4569/debugger/src/main/java/org/apache/pdfbox/debugger/ui/ViewMenu.java
Mon Sep 23 18:13:36 2019
@@ -16,9 +16,6 @@
  */
 package org.apache.pdfbox.debugger.ui;
 
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
 import javax.swing.JCheckBoxMenuItem;
 import javax.swing.JMenu;
 import javax.swing.JMenuItem;
@@ -147,25 +144,21 @@ public class ViewMenu extends MenuBase
         {
             viewModeItem = new JMenuItem("Show Pages");
         }
-        viewModeItem.addActionListener(new ActionListener()
+        viewModeItem.addActionListener(actionEvent ->
         {
-            @Override
-            public void actionPerformed(ActionEvent actionEvent)
+            if (pdfDebugger.isPageMode())
+            {
+                viewModeItem.setText("Show Pages");
+                pdfDebugger.setPageMode(false);
+            }
+            else
+            {
+                viewModeItem.setText("Show Internal Structure");
+                pdfDebugger.setPageMode(true);
+            }
+            if (pdfDebugger.hasDocument())
             {
-                if (pdfDebugger.isPageMode())
-                {
-                    viewModeItem.setText("Show Pages");
-                    pdfDebugger.setPageMode(false);
-                }
-                else
-                {
-                    viewModeItem.setText("Show Internal Structure");
-                    pdfDebugger.setPageMode(true);
-                }
-                if (pdfDebugger.hasDocument())
-                {
-                    pdfDebugger.initTree();
-                }
+                pdfDebugger.initTree();
             }
         });
         viewMenu.add(viewModeItem);

Modified: pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java?rev=1867389&r1=1867388&r2=1867389&view=diff
==============================================================================
--- pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java
(original)
+++ pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java
Mon Sep 23 18:13:36 2019
@@ -151,7 +151,7 @@ public class GlyphSubstitutionTable exte
                 // https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#slTbl_sRec
                 LOG.error("LangSysRecords not alphabetically sorted by LangSys tag: " +
                           langSysTags[i] + " <= " + langSysTags[i - 1]);
-                return new ScriptTable(null, new LinkedHashMap<String, LangSysTable>());
+                return new ScriptTable(null, new LinkedHashMap<>());
             }
             langSysOffsets[i] = data.readUnsignedShort();
         }
@@ -530,7 +530,7 @@ public class GlyphSubstitutionTable exte
             return Collections.emptyList();
         }
         List<FeatureRecord> result = new ArrayList<>();
-        for (LangSysTable langSysTable : langSysTables)
+        langSysTables.forEach(langSysTable ->
         {
             int required = langSysTable.getRequiredFeatureIndex();
             if (required != 0xffff) // if no required features = 0xFFFF
@@ -546,7 +546,7 @@ public class GlyphSubstitutionTable exte
                     result.add(featureListTable.getFeatureRecords()[featureIndex]);
                 }
             }
-        }
+        });
 
         // 'vrt2' supersedes 'vert' and they should not be used together
         // https://www.microsoft.com/typography/otspec/features_uz.htm
@@ -573,14 +573,8 @@ public class GlyphSubstitutionTable exte
 
     private boolean containsFeature(List<FeatureRecord> featureRecords, String featureTag)
     {
-        for (FeatureRecord featureRecord : featureRecords)
-        {
-            if (featureRecord.getFeatureTag().equals(featureTag))
-            {
-                return true;
-            }
-        }
-        return false;
+        return featureRecords.stream().anyMatch(
+                   featureRecord -> featureRecord.getFeatureTag().equals(featureTag));
     }
 
     private void removeFeature(List<FeatureRecord> featureRecords, String featureTag)

Modified: pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/OpenTypeScript.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/OpenTypeScript.java?rev=1867389&r1=1867388&r2=1867389&view=diff
==============================================================================
--- pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/OpenTypeScript.java
(original)
+++ pdfbox/branches/issue4569/fontbox/src/main/java/org/apache/fontbox/ttf/OpenTypeScript.java
Mon Sep 23 18:13:36 2019
@@ -21,7 +21,6 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.LineNumberReader;
 import java.util.Arrays;
-import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -244,14 +243,7 @@ public final class OpenTypeScript
 
     private static void parseScriptsFile(InputStream inputStream) throws IOException
     {
-        Map<int[], String> unicodeRanges = new TreeMap<>(new Comparator<int[]>()
-        {
-            @Override
-            public int compare(int[] o1, int[] o2)
-            {
-                return Integer.compare(o1[0], o2[0]);
-            };
-        });
+        Map<int[], String> unicodeRanges = new TreeMap<>((o1, o2) -> Integer.compare(o1[0],
o2[0]));
         try (LineNumberReader rd = new LineNumberReader(new InputStreamReader(inputStream)))
         {
             int[] lastRange = { Integer.MIN_VALUE, Integer.MIN_VALUE };

Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java?rev=1867389&r1=1867388&r2=1867389&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java (original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java Mon
Sep 23 18:13:36 2019
@@ -514,10 +514,7 @@ public class PDPage implements COSObject
     public void setContents(List<PDStream> contents)
     {
         COSArray array = new COSArray();
-        for (PDStream stream : contents)
-        {
-            array.add(stream);
-        }
+        contents.forEach(stream -> array.add(stream));
         page.setItem(COSName.CONTENTS, array);
     }
 
@@ -658,14 +655,7 @@ public class PDPage implements COSObject
      */
     public List<PDAnnotation> getAnnotations() throws IOException
     {
-        return getAnnotations(new AnnotationFilter()
-        {
-            @Override
-            public boolean accept(PDAnnotation annotation)
-            {
-                return true;
-            }
-        });
+        return getAnnotations(annotation -> true);
     }
 
     /**
@@ -774,10 +764,7 @@ public class PDPage implements COSObject
             return;
         }
         COSArray array = new COSArray();
-        for (PDViewportDictionary viewport : viewports)
-        {
-            array.add(viewport);
-        }
+        viewports.forEach(viewport -> array.add(viewport));
         page.setItem(COSName.VP, array);
     }
 

Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabels.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabels.java?rev=1867389&r1=1867388&r2=1867389&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabels.java
(original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDPageLabels.java
Mon Sep 23 18:13:36 2019
@@ -204,16 +204,8 @@ public class PDPageLabels implements COS
      */
     public Map<String, Integer> getPageIndicesByLabels()
     {
-        final Map<String, Integer> labelMap = 
-            new HashMap<>(doc.getNumberOfPages());
-        computeLabels(new LabelHandler()
-        {
-            @Override
-            public void newLabel(int pageIndex, String label)
-            {
-                labelMap.put(label, pageIndex);
-            }
-        });
+        final Map<String, Integer> labelMap = new HashMap<>(doc.getNumberOfPages());
+        computeLabels((pageIndex, label) -> labelMap.put(label, pageIndex));
         return labelMap;
     }
 
@@ -227,15 +219,11 @@ public class PDPageLabels implements COS
     public String[] getLabelsByPageIndices()
     {
         final String[] map = new String[doc.getNumberOfPages()];
-        computeLabels(new LabelHandler()
+        computeLabels((pageIndex, label) ->
         {
-            @Override
-            public void newLabel(int pageIndex, String label)
+            if (pageIndex < doc.getNumberOfPages())
             {
-                if(pageIndex < doc.getNumberOfPages())
-                { 
-                    map[pageIndex] = label;
-                }
+                map[pageIndex] = label;
             }
         });
         return map;

Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineNode.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineNode.java?rev=1867389&r1=1867388&r2=1867389&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineNode.java
(original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineNode.java
Mon Sep 23 18:13:36 2019
@@ -16,7 +16,6 @@
  */
 package org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline;
 
-import java.util.Iterator;
 
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
@@ -36,7 +35,6 @@ public abstract class PDOutlineNode exte
      */
     public PDOutlineNode()
     {
-        super();
     }
 
     /**
@@ -308,13 +306,6 @@ public abstract class PDOutlineNode exte
      */
     public Iterable<PDOutlineItem> children()
     {
-        return new Iterable<PDOutlineItem>()
-        {
-            @Override
-            public Iterator<PDOutlineItem> iterator()
-            {
-                return new PDOutlineItemIterator(getFirstChild());
-            }
-        };
+        return () -> new PDOutlineItemIterator(getFirstChild());
     }
 }

Modified: pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java?rev=1867389&r1=1867388&r2=1867389&view=diff
==============================================================================
--- pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
(original)
+++ pdfbox/branches/issue4569/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
Mon Sep 23 18:13:36 2019
@@ -39,7 +39,6 @@ import org.apache.pdfbox.pdmodel.graphic
 import org.apache.pdfbox.pdmodel.graphics.optionalcontent.PDOptionalContentProperties;
 import org.apache.pdfbox.pdmodel.graphics.state.PDExtendedGraphicsState;
 import org.apache.pdfbox.pdmodel.interactive.annotation.AnnotationFilter;
-import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation;
 
 /**
  * Renders a PDF document to an AWT BufferedImage.
@@ -57,14 +56,7 @@ public class PDFRenderer
     /**
     * Default annotations filter, returns all annotations
     */
-    private AnnotationFilter annotationFilter = new AnnotationFilter()
-    {
-        @Override
-        public boolean accept(PDAnnotation annotation)
-        {
-            return true;
-        }
-    };
+    private AnnotationFilter annotationFilter = annotation -> true;
 
     private boolean subsamplingAllowed = false;
 



Mime
View raw message