diff truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/BranchProfileTest.java @ 22526:a5e58793bbca

BranchProfile Javadoc sample was uncompilable. Fixed with the help of codesnippet tag.
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Wed, 30 Dec 2015 11:06:33 +0100
parents a63bda98cfdb
children 4ba1aa33fda4
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/BranchProfileTest.java	Wed Dec 23 07:43:06 2015 +0100
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/BranchProfileTest.java	Wed Dec 30 11:06:33 2015 +0100
@@ -22,6 +22,7 @@
  */
 package com.oracle.truffle.api.profiles;
 
+import com.oracle.truffle.api.nodes.Node;
 import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
@@ -47,4 +48,17 @@
         assertTrue(profile.toString().contains(Integer.toHexString(profile.hashCode())));
     }
 
+    // BEGIN: BranchProfileSample
+    class SampleNode extends Node {
+        final BranchProfile errorProfile = BranchProfile.create();
+
+        int execute(int value) {
+            if (value == Integer.MAX_VALUE) {
+                errorProfile.enter();
+                throw new Error("Invalid input value");
+            }
+            return value;
+        }
+    }
+    // END: BranchProfileSample
 }