~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/ikvm/runtime/attributes.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright (C) 2002-2011 Jeroen Frijters
 
3
 
 
4
  This software is provided 'as-is', without any express or implied
 
5
  warranty.  In no event will the authors be held liable for any damages
 
6
  arising from the use of this software.
 
7
 
 
8
  Permission is granted to anyone to use this software for any purpose,
 
9
  including commercial applications, and to alter it and redistribute it
 
10
  freely, subject to the following restrictions:
 
11
 
 
12
  1. The origin of this software must not be misrepresented; you must not
 
13
     claim that you wrote the original software. If you use this software
 
14
     in a product, an acknowledgment in the product documentation would be
 
15
     appreciated but is not required.
 
16
  2. Altered source versions must be plainly marked as such, and must not be
 
17
     misrepresented as being the original software.
 
18
  3. This notice may not be removed or altered from any source distribution.
 
19
 
 
20
  Jeroen Frijters
 
21
  jeroen@frijters.net
 
22
  
 
23
*/
 
24
using System;
 
25
#if STATIC_COMPILER || STUB_GENERATOR
 
26
using IKVM.Reflection;
 
27
using Type = IKVM.Reflection.Type;
 
28
#else
 
29
using System.Reflection;
 
30
#endif
 
31
 
 
32
namespace IKVM.Attributes
 
33
{
 
34
        [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Delegate)]
 
35
        public sealed class SourceFileAttribute : Attribute
 
36
        {
 
37
                private string file;
 
38
 
 
39
                public SourceFileAttribute(string file)
 
40
                {
 
41
                        this.file = file;
 
42
                }
 
43
 
 
44
                public string SourceFile
 
45
                {
 
46
                        get
 
47
                        {
 
48
                                return file;
 
49
                        }
 
50
                }
 
51
        }
 
52
 
 
53
        [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor)]
 
54
        public sealed class LineNumberTableAttribute : Attribute
 
55
        {
 
56
                private byte[] table;
 
57
 
 
58
                public LineNumberTableAttribute(ushort lineno)
 
59
                {
 
60
                        LineNumberWriter w = new LineNumberWriter(1);
 
61
                        w.AddMapping(0, lineno);
 
62
                        table = w.ToArray();
 
63
                }
 
64
 
 
65
                public LineNumberTableAttribute(byte[] table)
 
66
                {
 
67
                        this.table = table;
 
68
                }
 
69
 
 
70
                public sealed class LineNumberWriter
 
71
                {
 
72
                        private System.IO.MemoryStream stream;
 
73
                        private int prevILOffset;
 
74
                        private int prevLineNum;
 
75
                        private int count;
 
76
 
 
77
                        public LineNumberWriter(int estimatedCount)
 
78
                        {
 
79
                                stream = new System.IO.MemoryStream(estimatedCount * 2);
 
80
                        }
 
81
 
 
82
                        public void AddMapping(int ilOffset, int linenumber)
 
83
                        {
 
84
                                if(count == 0)
 
85
                                {
 
86
                                        if(ilOffset == 0 && linenumber != 0)
 
87
                                        {
 
88
                                                prevLineNum = linenumber;
 
89
                                                count++;
 
90
                                                WritePackedInteger(linenumber - (64 + 50));
 
91
                                                return;
 
92
                                        }
 
93
                                        else
 
94
                                        {
 
95
                                                prevLineNum = linenumber & ~3;
 
96
                                                WritePackedInteger(((-prevLineNum / 4) - (64 + 50)));
 
97
                                        }
 
98
                                }
 
99
                                bool pc_overflow;
 
100
                                bool lineno_overflow;
 
101
                                byte lead;
 
102
                                int deltaPC = ilOffset - prevILOffset;
 
103
                                if(deltaPC >= 0 && deltaPC < 31)
 
104
                                {
 
105
                                        lead = (byte)deltaPC;
 
106
                                        pc_overflow = false;
 
107
                                }
 
108
                                else
 
109
                                {
 
110
                                        lead = (byte)31;
 
111
                                        pc_overflow = true;
 
112
                                }
 
113
                                int deltaLineNo = linenumber - prevLineNum;
 
114
                                const int bias = 2;
 
115
                                if(deltaLineNo >= -bias && deltaLineNo < 7 - bias)
 
116
                                {
 
117
                                        lead |= (byte)((deltaLineNo + bias) << 5);
 
118
                                        lineno_overflow = false;
 
119
                                }
 
120
                                else
 
121
                                {
 
122
                                        lead |= (byte)(7 << 5);
 
123
                                        lineno_overflow = true;
 
124
                                }
 
125
                                stream.WriteByte(lead);
 
126
                                if(pc_overflow)
 
127
                                {
 
128
                                        WritePackedInteger(deltaPC - (64 + 31));
 
129
                                }
 
130
                                if(lineno_overflow)
 
131
                                {
 
132
                                        WritePackedInteger(deltaLineNo);
 
133
                                }
 
134
                                prevILOffset = ilOffset;
 
135
                                prevLineNum = linenumber;
 
136
                                count++;
 
137
                        }
 
138
 
 
139
                        public int Count
 
140
                        {
 
141
                                get
 
142
                                {
 
143
                                        return count;
 
144
                                }
 
145
                        }
 
146
 
 
147
                        public int LineNo
 
148
                        {
 
149
                                get
 
150
                                {
 
151
                                        return prevLineNum;
 
152
                                }
 
153
                        }
 
154
 
 
155
                        public byte[] ToArray()
 
156
                        {
 
157
                                return stream.ToArray();
 
158
                        }
 
159
 
 
160
                        /*
 
161
                         * packed integer format:
 
162
                         * ----------------------
 
163
                         * 
 
164
                         * First byte:
 
165
                         * 00 - 7F      Single byte integer (-64 - 63)
 
166
                         * 80 - BF      Double byte integer (-8192 - 8191)
 
167
                         * C0 - DF      Triple byte integer (-1048576 - 1048576)
 
168
                         * E0 - FE      Reserved
 
169
                         * FF           Five byte integer
 
170
                         */
 
171
                        private void WritePackedInteger(int val)
 
172
                        {
 
173
                                if(val >= -64 && val < 64)
 
174
                                {
 
175
                                        val += 64;
 
176
                                        stream.WriteByte((byte)val);
 
177
                                }
 
178
                                else if(val >= -8192 && val < 8192)
 
179
                                {
 
180
                                        val += 8192;
 
181
                                        stream.WriteByte((byte)(0x80 + (val >> 8)));
 
182
                                        stream.WriteByte((byte)val);
 
183
                                }
 
184
                                else if(val >= -1048576 && val < 1048576)
 
185
                                {
 
186
                                        val += 1048576;
 
187
                                        stream.WriteByte((byte)(0xC0 + (val >> 16)));
 
188
                                        stream.WriteByte((byte)(val >> 8));
 
189
                                        stream.WriteByte((byte)val);
 
190
                                }
 
191
                                else
 
192
                                {
 
193
                                        stream.WriteByte(0xFF);
 
194
                                        stream.WriteByte((byte)(val >> 24));
 
195
                                        stream.WriteByte((byte)(val >> 16));
 
196
                                        stream.WriteByte((byte)(val >>  8));
 
197
                                        stream.WriteByte((byte)(val >>  0));
 
198
                                }
 
199
                        }
 
200
                }
 
201
 
 
202
                private int ReadPackedInteger(ref int position)
 
203
                {
 
204
                        byte b = table[position++];
 
205
                        if(b < 128)
 
206
                        {
 
207
                                return b - 64;
 
208
                        }
 
209
                        else if((b & 0xC0) == 0x80)
 
210
                        {
 
211
                                return ((b & 0x7F) << 8) + table[position++] - 8192;
 
212
                        }
 
213
                        else if((b & 0xE0) == 0xC0)
 
214
                        {
 
215
                                int val = ((b & 0x3F) << 16);
 
216
                                val += (table[position++] << 8);
 
217
                                val += table[position++];
 
218
                                return val - 1048576;
 
219
                        }
 
220
                        else if(b == 0xFF)
 
221
                        {
 
222
                                int val = table[position++] << 24;
 
223
                                val += table[position++] << 16;
 
224
                                val += table[position++] <<  8;
 
225
                                val += table[position++] <<  0;
 
226
                                return val;
 
227
                        }
 
228
                        else
 
229
                        {
 
230
                                throw new InvalidProgramException();
 
231
                        }
 
232
                }
 
233
 
 
234
                public int GetLineNumber(int ilOffset)
 
235
                {
 
236
                        int i = 0;
 
237
                        int prevILOffset = 0;
 
238
                        int prevLineNum = ReadPackedInteger(ref i) + (64 + 50);
 
239
                        int line;
 
240
                        if(prevLineNum > 0)
 
241
                        {
 
242
                                line = prevLineNum;
 
243
                        }
 
244
                        else
 
245
                        {
 
246
                                prevLineNum = 4 * -prevLineNum;
 
247
                                line = -1;
 
248
                        }
 
249
                        while(i < table.Length)
 
250
                        {
 
251
                                byte lead = table[i++];
 
252
                                int deltaPC = lead & 31;
 
253
                                int deltaLineNo = (lead >> 5) - 2;
 
254
                                if(deltaPC == 31)
 
255
                                {
 
256
                                        deltaPC = ReadPackedInteger(ref i) + (64 + 31);
 
257
                                }
 
258
                                if(deltaLineNo == 5)
 
259
                                {
 
260
                                        deltaLineNo = ReadPackedInteger(ref i);
 
261
                                }
 
262
                                int currILOffset = prevILOffset + deltaPC;
 
263
                                if(currILOffset > ilOffset)
 
264
                                {
 
265
                                        return line;
 
266
                                }
 
267
                                line = prevLineNum + deltaLineNo;
 
268
                                prevILOffset = currILOffset;
 
269
                                prevLineNum = line;
 
270
                        }
 
271
                        return line;
 
272
                }
 
273
        }
 
274
 
 
275
        [AttributeUsage(AttributeTargets.Class)]
 
276
        public sealed class ExceptionIsUnsafeForMappingAttribute : Attribute
 
277
        {
 
278
        }
 
279
 
 
280
        [AttributeUsage(AttributeTargets.Interface)]
 
281
        public sealed class RemappedInterfaceMethodAttribute : Attribute
 
282
        {
 
283
                private string name;
 
284
                private string mappedTo;
 
285
                private string[] throws;
 
286
 
 
287
                public RemappedInterfaceMethodAttribute(string name, string mappedTo, string[] throws)
 
288
                {
 
289
                        this.name = name;
 
290
                        this.mappedTo = mappedTo;
 
291
                        this.throws = throws;
 
292
                }
 
293
 
 
294
                public string Name
 
295
                {
 
296
                        get
 
297
                        {
 
298
                                return name;
 
299
                        }
 
300
                }
 
301
 
 
302
                public string MappedTo
 
303
                {
 
304
                        get
 
305
                        {
 
306
                                return mappedTo;
 
307
                        }
 
308
                }
 
309
 
 
310
                public string[] Throws
 
311
                {
 
312
                        get
 
313
                        {
 
314
                                return throws;
 
315
                        }
 
316
                }
 
317
        }
 
318
 
 
319
        [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
 
320
        public sealed class RemappedClassAttribute : Attribute
 
321
        {
 
322
                private string name;
 
323
                private Type remappedType;
 
324
 
 
325
#if STUB_GENERATOR
 
326
                public RemappedClassAttribute(string name, System.Type remappedType)
 
327
                {
 
328
                }
 
329
#endif
 
330
 
 
331
                public RemappedClassAttribute(string name, Type remappedType)
 
332
                {
 
333
                        this.name = name;
 
334
                        this.remappedType = remappedType;
 
335
                }
 
336
 
 
337
                public string Name
 
338
                {
 
339
                        get
 
340
                        {
 
341
                                return name;
 
342
                        }
 
343
                }
 
344
 
 
345
                public Type RemappedType
 
346
                {
 
347
                        get
 
348
                        {
 
349
                                return remappedType;
 
350
                        }
 
351
                }
 
352
        }
 
353
 
 
354
        [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
 
355
        public sealed class RemappedTypeAttribute : Attribute
 
356
        {
 
357
                private Type type;
 
358
 
 
359
#if STUB_GENERATOR
 
360
                public RemappedTypeAttribute(System.Type type)
 
361
                {
 
362
                }
 
363
#endif
 
364
 
 
365
                public RemappedTypeAttribute(Type type)
 
366
                {
 
367
                        this.type = type;
 
368
                }
 
369
 
 
370
                public Type Type
 
371
                {
 
372
                        get
 
373
                        {
 
374
                                return type;
 
375
                        }
 
376
                }
 
377
        }
 
378
 
 
379
        [AttributeUsage(AttributeTargets.Module)]
 
380
        public sealed class JavaModuleAttribute : Attribute
 
381
        {
 
382
                private string[] classMap;
 
383
                private string[] jars;
 
384
 
 
385
                public JavaModuleAttribute()
 
386
                {
 
387
                }
 
388
 
 
389
                public JavaModuleAttribute(string[] classMap)
 
390
                {
 
391
                        this.classMap = classMap;
 
392
                }
 
393
 
 
394
                public string[] GetClassMap()
 
395
                {
 
396
                        return classMap;
 
397
                }
 
398
 
 
399
                public string[] Jars
 
400
                {
 
401
                        get { return jars; }
 
402
                        set { jars = value; }
 
403
                }
 
404
        }
 
405
 
 
406
        [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Assembly)]
 
407
        public sealed class NoPackagePrefixAttribute : Attribute
 
408
        {
 
409
        }
 
410
 
 
411
        [AttributeUsage(AttributeTargets.Struct)]
 
412
        public sealed class GhostInterfaceAttribute : Attribute
 
413
        {
 
414
        }
 
415
 
 
416
        // Whenever the VM or compiler generates a helper class/method/field, it should be marked
 
417
        // with this custom attribute, so that it can be hidden from Java.
 
418
        [AttributeUsage(AttributeTargets.All)]
 
419
        public sealed class HideFromJavaAttribute : Attribute
 
420
        {
 
421
        }
 
422
 
 
423
        [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Property)]
 
424
        public sealed class HideFromReflectionAttribute : Attribute
 
425
        {
 
426
        }
 
427
 
 
428
        [Flags]
 
429
        public enum Modifiers : ushort
 
430
        {
 
431
                Public                  = 0x0001,
 
432
                Private                 = 0x0002,
 
433
                Protected               = 0x0004,
 
434
                Static                  = 0x0008,
 
435
                Final                   = 0x0010,
 
436
                Super                   = 0x0020,
 
437
                Synchronized    = 0x0020,
 
438
                Volatile                = 0x0040,
 
439
                Bridge                  = 0x0040,
 
440
                Transient               = 0x0080,
 
441
                VarArgs                 = 0x0080,
 
442
                Native                  = 0x0100,
 
443
                Interface               = 0x0200,
 
444
                Abstract                = 0x0400,
 
445
                Strictfp                = 0x0800,
 
446
                Synthetic               = 0x1000,
 
447
                Annotation              = 0x2000,
 
448
                Enum                    = 0x4000,
 
449
 
 
450
                // Masks
 
451
                AccessMask              = Public | Private | Protected
 
452
        }
 
453
 
 
454
        [AttributeUsage(AttributeTargets.All)]
 
455
        public sealed class ModifiersAttribute : Attribute
 
456
        {
 
457
                private Modifiers modifiers;
 
458
                private bool isInternal;
 
459
 
 
460
                public ModifiersAttribute(Modifiers modifiers)
 
461
                {
 
462
                        this.modifiers = modifiers;
 
463
                }
 
464
 
 
465
                public ModifiersAttribute(Modifiers modifiers, bool isInternal)
 
466
                {
 
467
                        this.modifiers = modifiers;
 
468
                        this.isInternal = isInternal;
 
469
                }
 
470
 
 
471
                public bool IsInternal
 
472
                {
 
473
                        get
 
474
                        {
 
475
                                return isInternal;
 
476
                        }
 
477
                }
 
478
 
 
479
                public Modifiers Modifiers
 
480
                {
 
481
                        get
 
482
                        {
 
483
                                return modifiers;
 
484
                        }
 
485
                }
 
486
        }
 
487
 
 
488
        [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Field)]
 
489
        public sealed class NameSigAttribute : Attribute
 
490
        {
 
491
                private string name;
 
492
                private string sig;
 
493
 
 
494
                public NameSigAttribute(string name, string sig)
 
495
                {
 
496
                        this.name = name;
 
497
                        this.sig = sig;
 
498
                }
 
499
 
 
500
                public string Name
 
501
                {
 
502
                        get
 
503
                        {
 
504
                                return name;
 
505
                        }
 
506
                }
 
507
 
 
508
                public string Sig
 
509
                {
 
510
                        get
 
511
                        {
 
512
                                return sig;
 
513
                        }
 
514
                }
 
515
        }
 
516
 
 
517
        [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method)]
 
518
        public sealed class ThrowsAttribute : Attribute
 
519
        {
 
520
                internal string[] classes;
 
521
                internal Type[] types;
 
522
 
 
523
                // this constructor is used by ikvmc, the other constructors are for use in other .NET languages
 
524
                public ThrowsAttribute(string[] classes)
 
525
                {
 
526
                        this.classes = classes;
 
527
                }
 
528
 
 
529
                public ThrowsAttribute(Type type)
 
530
                        : this(new Type[] { type })
 
531
                {
 
532
                }
 
533
 
 
534
                public ThrowsAttribute(params Type[] types)
 
535
                {
 
536
                        this.types = types;
 
537
                }
 
538
 
 
539
                // dotted Java class names (e.g. java.lang.Throwable)
 
540
                [Obsolete]
 
541
                public string[] Classes
 
542
                {
 
543
                        get
 
544
                        {
 
545
                                return classes;
 
546
                        }
 
547
                }
 
548
        }
 
549
 
 
550
        [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
 
551
        public sealed class ImplementsAttribute : Attribute
 
552
        {
 
553
                private string[] interfaces;
 
554
 
 
555
                // NOTE this is not CLS compliant, so maybe we should have a couple of overloads
 
556
                public ImplementsAttribute(string[] interfaces)
 
557
                {
 
558
                        this.interfaces = interfaces;
 
559
                }
 
560
 
 
561
                public string[] Interfaces
 
562
                {
 
563
                        get
 
564
                        {
 
565
                                return interfaces;
 
566
                        }
 
567
                }
 
568
        }
 
569
 
 
570
        // NOTE this attribute is also used by annotation attribute classes,
 
571
        // to give them a different name in the Java world ($Proxy[Annotation]).
 
572
        [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
 
573
        public sealed class InnerClassAttribute : Attribute
 
574
        {
 
575
                private string innerClassName;
 
576
                private Modifiers modifiers;
 
577
 
 
578
                public InnerClassAttribute(string innerClassName, Modifiers modifiers)
 
579
                {
 
580
                        this.innerClassName = innerClassName;
 
581
                        this.modifiers = modifiers;
 
582
                }
 
583
 
 
584
                public string InnerClassName
 
585
                {
 
586
                        get
 
587
                        {
 
588
                                return innerClassName;
 
589
                        }
 
590
                }
 
591
 
 
592
                public Modifiers Modifiers
 
593
                {
 
594
                        get
 
595
                        {
 
596
                                return modifiers;
 
597
                        }
 
598
                }
 
599
        }
 
600
 
 
601
        [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)]
 
602
        public sealed class NonNestedInnerClassAttribute : Attribute
 
603
        {
 
604
                private string innerClassName;
 
605
 
 
606
                public NonNestedInnerClassAttribute(string innerClassName)
 
607
                {
 
608
                        this.innerClassName = innerClassName;
 
609
                }
 
610
 
 
611
                public string InnerClassName
 
612
                {
 
613
                        get
 
614
                        {
 
615
                                return innerClassName;
 
616
                        }
 
617
                }
 
618
        }
 
619
 
 
620
        [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
 
621
        public sealed class NonNestedOuterClassAttribute : Attribute
 
622
        {
 
623
                private string outerClassName;
 
624
 
 
625
                public NonNestedOuterClassAttribute(string outerClassName)
 
626
                {
 
627
                        this.outerClassName = outerClassName;
 
628
                }
 
629
 
 
630
                public string OuterClassName
 
631
                {
 
632
                        get
 
633
                        {
 
634
                                return outerClassName;
 
635
                        }
 
636
                }
 
637
        }
 
638
 
 
639
        [AttributeUsage(AttributeTargets.Assembly)]
 
640
        public sealed class CustomAssemblyClassLoaderAttribute : Attribute
 
641
        {
 
642
                private Type type;
 
643
 
 
644
                public CustomAssemblyClassLoaderAttribute(Type type)
 
645
                {
 
646
                        this.type = type;
 
647
                }
 
648
 
 
649
                public Type Type
 
650
                {
 
651
                        get
 
652
                        {
 
653
                                return type;
 
654
                        }
 
655
                }
 
656
        }
 
657
 
 
658
        [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Method | AttributeTargets.Field)]
 
659
        public sealed class SignatureAttribute : Attribute
 
660
        {
 
661
                private string signature;
 
662
 
 
663
                public SignatureAttribute(string signature)
 
664
                {
 
665
                        this.signature = signature;
 
666
                }
 
667
 
 
668
                public string Signature
 
669
                {
 
670
                        get
 
671
                        {
 
672
                                return signature;
 
673
                        }
 
674
                }
 
675
        }
 
676
 
 
677
        [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
 
678
        public sealed class EnclosingMethodAttribute : Attribute
 
679
        {
 
680
                private string className;
 
681
                private string methodName;
 
682
                private string methodSig;
 
683
 
 
684
                public EnclosingMethodAttribute(string className, string methodName, string methodSig)
 
685
                {
 
686
                        this.className = className;
 
687
                        this.methodName = methodName;
 
688
                        this.methodSig = methodSig;
 
689
                }
 
690
 
 
691
                public string ClassName
 
692
                {
 
693
                        get
 
694
                        {
 
695
                                return className;
 
696
                        }
 
697
                }
 
698
 
 
699
                public string MethodName
 
700
                {
 
701
                        get
 
702
                        {
 
703
                                return methodName;
 
704
                        }
 
705
                }
 
706
 
 
707
                public string MethodSignature
 
708
                {
 
709
                        get
 
710
                        {
 
711
                                return methodSig;
 
712
                        }
 
713
                }
 
714
        }
 
715
 
 
716
        [AttributeUsage(AttributeTargets.Method)]
 
717
        public sealed class AnnotationDefaultAttribute : Attribute
 
718
        {
 
719
                public const byte TAG_ENUM = (byte)'e';
 
720
                public const byte TAG_CLASS = (byte)'c';
 
721
                public const byte TAG_ANNOTATION = (byte)'@';
 
722
                public const byte TAG_ARRAY = (byte)'[';
 
723
                public const byte TAG_ERROR = (byte)'?';
 
724
                private object defaultValue;
 
725
 
 
726
                // element_value encoding:
 
727
                // primitives:
 
728
                //   boxed values
 
729
                // string:
 
730
                //   string
 
731
                // enum:
 
732
                //   new object[] { (byte)'e', "<EnumType>", "<enumvalue>" }
 
733
                // class:
 
734
                //   new object[] { (byte)'c', "<Type>" }
 
735
                // annotation:
 
736
                //   new object[] { (byte)'@', "<AnnotationType>", ("name", (element_value))* }
 
737
                // array:
 
738
                //   new object[] { (byte)'[', (element_value)* }
 
739
                // error:
 
740
                //   new object[] { (byte)'?', "<exceptionClass>", "<exceptionMessage>" }
 
741
                public AnnotationDefaultAttribute(object defaultValue)
 
742
                {
 
743
                        this.defaultValue = defaultValue;
 
744
                }
 
745
 
 
746
                public object Value
 
747
                {
 
748
                        get
 
749
                        {
 
750
                                return defaultValue;
 
751
                        }
 
752
                }
 
753
        }
 
754
 
 
755
        [AttributeUsage(AttributeTargets.Interface)]
 
756
        public sealed class AnnotationAttributeAttribute : Attribute
 
757
        {
 
758
                private string attributeType;
 
759
 
 
760
                public AnnotationAttributeAttribute(string attributeType)
 
761
                {
 
762
                        this.attributeType = attributeType;
 
763
                }
 
764
 
 
765
                public string AttributeType
 
766
                {
 
767
                        get
 
768
                        {
 
769
                                return attributeType;
 
770
                        }
 
771
                }
 
772
        }
 
773
 
 
774
        [AttributeUsage(AttributeTargets.Module)]
 
775
        public sealed class PackageListAttribute : Attribute
 
776
        {
 
777
                private string[] packages;
 
778
 
 
779
                public PackageListAttribute(string[] packages)
 
780
                {
 
781
                        this.packages = packages;
 
782
                }
 
783
 
 
784
                public string[] GetPackages()
 
785
                {
 
786
                        return packages;
 
787
                }
 
788
        }
 
789
 
 
790
        // used in custom modifier for access stubs
 
791
        public static class AccessStub { }
 
792
}